Wednesday, 25 June 2014

WSP Deployment Using Power Shell

1.Develop Custom Webpart
Open PowerShell and Run as Administrator
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe
Adding
------------
write-host “Adding Snapin”
Add-PsSnapin Microsoft.SharePoint.PowerShell
write-host “Added"
Add-SPSolution “D:\MySPSolution.wsp“
Install-SPSolution –Identity MySPSolution.wsp –WebApplication http://SP2010:8888 –GACDeployment
Update wsp
————-
Update-SPSolution –Identity MySPSolution.wsp –LiteralPath “D:\MySPSolution.wsp” –GacDeployment
unInstall wsp
————-
Uninstall-SPSolution –Identity MySPSolution.wsp –WebApplication http://sp2010
Remove-SPSolution–Identity MySPSolution.wsp
Or below
Uninstall-SPSolution -identity MySPSolution.wsp -Confirm:$false
Remove-SPSolution -identity MySPSolution.wsp -Confirm:$false
========================================================================
Specific to One site
========================================================================

write-host “Adding Snapin”
Add-PsSnapin Microsoft.SharePoint.PowerShell
write-host “Added"
Adding
-----
Add-SPSolution “C:\CustomWebPartTest.wsp"
Install-SPSolution –Identity CustomWebPartTest.wsp –WebApplication http://SP2010:8888 –GACDeployment
Update wsp
————-
Update-SPSolution –Identity MySPSolution.wsp –LiteralPath “D:\MySPSolution.wsp” –GacDeployment
Uninstall
--------------
Uninstall-SPSolution –Identity CustomWebPartTest.wsp –WebApplication http://SP2010:8888 -Confirm:$false
Remove-SPSolution -identity CustomWebPartTest.wsp -Confirm:$false
write-host “Removing Snapin”
Remove-PsSnapin Microsoft.SharePoint.PowerShell
write-host “Removed