Windows PowerShell cmdlets for SharePoint database


The following list is a sample of the SharePoint database tasks you can do by using Windows PowerShell:
  • Disconnect a local server computer from a farm — Disconnect-SPConfigurationDatabase
  • Connect a local server computer to a farm — Connect-SPConfigurationDatabase
  • Create a new configuration database — New-SPConfigurationDatabase
  • Remove a configuration database — Remove-SPConfigurationDatabase
  • Dismount a content database — Dismount-SPContentDatabase
  • Mount a content database — Mount-SPContentDatabase
  • Backup a SharePoint farm’s configuration — Backup-SPConfigurationDatabase -Directory <BackupFolder> -DatabaseServer <DatabaseServerName> -DatabaseName <DatabaseName> -DatabaseCredentials <WindowsPowerShellCredentialObject> [-Verbose]
  • Backup a complete SharePoint farm— Backup-SPFarm -Directory <BackupFolder> -BackupMethod {Full | Differential} [-Verbose]
  • Backup a SharePoint service application — Backup-SPFarm | -Directory <BackupFolder> -BackupMethod {Full | Differential} -Item <ServiceApplicationName> [-Verbose]
  • Restore a SharePoint farm’s configuration — Restore-SPFarm –Directory <RestoreShare> -RestoreMethod Overwrite –ConfigurationOnly
  • Restore a complete SharePoint farm — Restore-SPFarm –Directory <BackupFolder> -RestoreMethod Overwrite [–BackupId <GUID>]
  • Restore a SharePoint service application — Restore-SPFarm –Directory <BackupFolder> -Item “<ServiceApplicationName>” –RecoveryMethod Overwrite –BackupId <GUID> [-Verbose]
This list merely shows a small sample of what you can accomplish using Windows PowerShell when working with SharePoint 2010 databases.  For more details see the following topics:
 For help building and using Windows PowerShell cmdlets, see Bill Baer’s Windows PowerShell Command Builder available here,
 http://www.microsoft.com/resources/TechNet/en-us/Office/media/WindowsPowerShell/WindowsPowerShellCommandBuilder.html

Comments