Introduction
This article is a sequence of real world examples of using PowerShell in SharePoint 2016. In this article, we will discuss how we will use the PowerShell cmdlets to manage the Site Collection webPartPack in SharePoint. We will try to cover all the available cmdlets i.e. get, Install and Uninstall.
Scenario
KrossFarm SharePoint farm faces some issues with the RSwebpart. After a lot of troubleshooting they finally reached the point where have to uninstall and reinstall the RSwebPart. They already have the RSwebpart.cab file with them, which makes life easy.
Tasks
- Get the list of webparts to Install the farm
- Uninstall the RSwebpart from the farm
- Install the RSWebpart globally.
Get
Let’s get the list of all Webpart packs installed. Run the Below PowerShell
Get-SPWebPartPack
The output will be like this, but you will notice, this will only be the Name of the solution, ID, and Status of Deployment.
But If you run the below mentioned command, You will get complete details of each webpartpack.
Get-SPWebPartPack | select *
The output will be like this.
Uninstall
Now we will uninstall the RSwebpart from the farm.Please run the command below.
Uninstall-SPWebPartPack -Identity rswebparts.cab
The output will be like this.
Install
Finally, we will install the RSweb Part.Please run the below mentioned command.
Install-SPWebPartPack -LiteralPath "C:\Tempfiles\RSWebParts.cab" -GlobalInstall
This will deploy the RSwebpart globally (gacassembly) and all web applications in the farm.
But if you just want to install it to only specific web applications, then run the below command.
Install-SPWebPartPack -LiteralPath "C:\Tempfiles\RSWebParts.cab" -WebApplicationhttp://kfsp :9101
Note
I just use this as an example, the situation varies in your environment. This example is just for learning purposes and gives you an idea how to use commands.