Basic PowerShell Commands
There are 500+ SharePoint PowerShell commands. You can, use the | more technique to view one page at a time.
You can also redirect the output to a text file like this.
Get-Command –PSSnapin Microosft.SharePoint.PowerShell > commands.txt
Then you can just open the file in notepad or the editor of your choice.
PowerShell: Go to All Programs => Microsoft SharePoint 2010
Products =>SharePoint 2010 Management Shell =>Run as administrator.
1) Adding the solution:
Add-SPSolution
"C:\Users\sjfa\Desktop\WSPTest\WSPTest\bin\Debug\WSPTest.wsp"
You have successfully added the solution; it
gives the Name, Solution Id and Deployed status of the wsp file.
The Deployed status is false, we have just
added the wsp file but not deployed.
2) Deploying the solution:
Install-SPSolution -identity
"WSPTest.wsp" –webapplication http://spdemo2010:2011/
-GACDeployment
If you would like to add the solution as sandboxed, you would use the Install-SPUserSolution command instead.
3) Upgrade the solution:
To upgrade a solution, we specify which solution is to be updated and with which new solution file:Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “D:\Deploy\MySharePointSolution.wsp” –GacDeployment
To upgrade a solution, we specify which solution is to be updated and with which new solution file:Update-SPSolution –Identity MySharePointSolution.wsp –LiteralPath “D:\Deploy\MySharePointSolution.wsp” –GacDeployment
4) Retracting the Solution:
Uninstall-SPSolution -identity
"WSPTest.wsp"
5) Removing the solution:
Remove-SPSolution -identity
"WSPTest.wsp"
6) Installing the feature:
Install-SPFeature "C:\Program
Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\WSPTest_WSPContentTypeFeature"
It gives
the scope as ‘web’. Where "C:\Program Files\Common Files\Microsoft
Shared\Web Server
Extensions\14\TEMPLATE\FEATURES\WSPTest_WSPContentTypeFeature" is the
Folder Name Path.
7) Activating the feature: (Where
GUID is a unique id generated in all the 3 methods)
Enable-SPFeature -Identity " MyFeatureGuid" -Url "http://spdemo2010:2011//"
Eg: Enable-SPFeature
-Identity "00bfea71-e717-4e80-aa17-d0c71b360101" -Url http://spdemo2010/BICSite/dt/ to enable document library.
8) Deactivating the feature:
Disable-SPFeature -Identity " MyFeatureGuid
" -Url "http://servername:2010"
9) Uninstalling the feature:
Uninstall-SPFeature -Identity " MyFeatureGuid
"
10)
Backup Site Collection
Backup-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
Backup-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
11)
Restore SiteCollection
Restore-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
Restore-SPSite -Identity http://myserver -Path "c:\backup\file.bak"
However, once I had restored the backup I could not access the site. The problem was that I needed to deploy the custom SharePoint solution. So in case of site collection migration (with backup/restore) from one server to another or from one site collection to another, the steps should be:
1. Restore the backup.
2. If your source site collection (from where you taken
backup) uses custom SharePoint solution, then deploy the solution in the destination
site collection (where you are restoring the backup). If you try to access the
site without deploying solution then you may get the site non-functional.
3. Now you can try to access the site.
The important point here is that if you take
backup from one server to another and restore it, the custom solution related
to backup doesn’t go with backup. So after restoring backup you need to
manually deploy the solution on the destination server. Then it’ll hopefully
work.
No comments:
Post a Comment