Sunday, May 5, 2013

Important SharePoint 2010 PowerShell Commands

Deploying Webpart in SharePoint 2010 using PowerShell

Add-SPSolution “MyVisualWebPart.wsp“
Install-SPSolution –Identity MyVisualWebPart.wsp –WebApplication http://mywebapplication/ –GACDeployment
Note: If you would like to add the solution as sandboxed, you would use the Install-SPUserSolution command instead. 

To upgrade a solution, we specify which solution is to be updated and with which new solution file:
Update-SPSolution –Identity MyVisualWebPart.wsp –LiteralPath "D:\MyVisualWebPart.wsp" –GacDeployment
To retract and remove a solution, we use the following commands:
Uninstall-SPSolution –Identity MyVisualWebPart.wsp –WebApplication http://mywebapplication/

Remove-SPSolution–Identity wp_CreateSiteColl.wsp

Activate & De-Activate Feature:
Enable-SPFeature –Identity MyFeatureNameOrGuid –url http://mywebapplication

Disable-SPFeature –Identity MyFeatureNameOrGuid –url http://mywebapplication

Backup A SiteCollection:
Backup-SPSite -Identity http://mywebapplication/sites/mysitecoll -Path D:\mysitecoll.bak -Force -NoSiteLock

Restore SiteCollection:
Restore-SPSite -Identity http://mywebapplication/sites/mysitecoll -Path D:\mysitecoll.bak -Force

Deploy InfoPath Forms in SharePoint 2010:

To Install/Upload,Activate Infopath forms use below PowerShell scripts..
Install-SPInfoPathFormTemplate -Path C:\myform.xsn
Enable-SPInfoPathFormTemplate -Identity "myform.xsn" -Site "http://SPSite"

To Uninstall,Deactivate existing InfoPath forms Template using PowerShell script.

Uninstall-SPInfoPathFormTemplate -Identity myform.xsn
Disable-SPInfoPathFormTemplate -Identity "myform.xsn" -Site "http://SPSite"

To Verify existing InfoPath forms Template using PowerShell script.
Test-SPInfoPathFormTemplate -Identity myform.xsn

No comments:

Post a Comment