Using Powershell for deploying Sharepoint 2010 Solution and Backup/Restore

Now, let see how to deploy the SharePoint 2010 solution using Powershell.
 
Step 1 : Start->All Programs->MicrosoftSharepoint2010Products->open Sharepoint2010Managementshell
 
Type the command
 
Step 2 : Add-SPSolution “C:\SharePoint2010Solution.wsp”
 
Step 3 : Install-SPSolution -Identity SharePoint2010Solution.wsp -WebApplication http://myserver -GACDeployment
 
If you are using Sandbox Solution
 
Step 4 :
Install-SPUserSolution -Identity SharePoint2010Solution.wsp -WebApplication http://myserver -GACDeployment
 

For Updating the Sharepoint 2010 Solution type the following commands.
 
Step 5 : Update-SPSolution -Identity SharePoint2010Solution.wsp -LiteralPath “C:\SharePoint2010Solution.wsp” -GacDeployment
 
For retract and remove a solution, type the following commands:
 
Step 6 : Uninstall-SPSolution -Identity MySharePointSolution.wsp -WebApplication http://myserver

Step 7 :
Remove-SPSolution-Identity MySharePointSolution.wsp
 

Now let's see how to take Backup and Restore using Powershell.
 
Backup a Site collection with PowerShell command.
 
In SharePoint 2010, Power Shell command Backup-SPSite is used for taking backup. you can get details of the command from the msdn link. The following command will back up the site collection “
http://myserver”.
 
Backup-SPSite -Identity http://myserver -Path "
c:\backup\files.bak"
 
Restore a Site Collection with PowerShell command.
 
To restore site collection you'll use the following command. Use -Force if you want to overwrite the existing site collection.
 
Restore-SPSite -Identity http://myserver -Path "
c:\backup\files.bak"