Properly Install/Uninstall/Update Sharepoint Solution

Today I am providing the Power Shell Script that will install, uninstall or update a SharePoint solution (wsp file) in SharePoint. It will also activate/deactivate the site collection, Web app feature in SharePoint web application/Site collection.

Path - Provide log file path to save the logs of the script.
Action - Select option to be performed - 1 for update, 2 for Install or 3 for Uninstall
webapplication url - provide web application url for installing the wsp file and activating the feature.

Solution will be installed, uninstalled and updated on the bases of selected option.if you are selecting uninstall or update solution a backup of existing wsp will be taken from SharePoint in log file path.

.\scriptname.ps1 | out-file “FilePath\Filename.txt”

Dependencies –
Solution and script should be saved in same folder. it will install/uninstall all the solutions.
For activating/deactivating a feature, feature name should contain the name of wsp file in its name.
For executing this script user must be added in site collection administrators in the sites.
User should have Shell Admin rights to run the scripts.
Run Management Shell as an Administrator.
How to execute -
Copy this script and paste in Note pad.
Save this file as .ps1.
Run this script in SharePoint Management Shell. You can run this script in PowerShell as well.
Follow on screen instructions.


Go to above link to get the script.

No comments:

Post a Comment