These two commands are probably the first PowerShell commands that everyone touches, one is to back up the site collection and the other is to restore the site collection.
Backup-spsite Example
Backup-spsite Http://site_name-Path C:\Backup\site_name.bak
Parameters
- Force: Overwrite existing backup
- Nositelock: Sets whether the site collection can read and write when the backup is set. If this parameter is not specified, the site collection is set to read-only during the backup and the site collection is restored to its original state after the backup is complete.
Restore-spsite Example
Restore-spsite Http://site_name-Path C:\Backup\site_name.bak
Parameters
- Force: Overwrites a site collection on an existing URL address
- Contentdatabase: Specifies which content database to restore to; If you do not specify a content database that will use the maximum capacity of unused site collections, its database state is ready.
- Databaseserver & DatabaseName: Specifying the data server name and data name
Enjoy SharePoint
SharePoint PowerShell Command Series (1) Backup-spsite & Restore-spsite