Scenario/Problem: You want to move all site collections stored in one content database to a different content database.
Solution: Use the Move-SPSite
cmdlet with the Get-SPSite
cmdlet.
You can pipe the results of Get-SPSite
to the Move-SPSite
cmdlet. Therefore, by using the ContentDatabase
parameter with Get-SPSite
, you can easily move all site collections from that content database to a new content database. Listing 8.18 shows a sample command line.
Get-SPSite -ContentDatabase "WSS_CONTENT_MAIN" | Move-SPSite
-DestinationDatabase "WSS_CONTENT_TEAMSITES"
As with moving a single site collection, the destination database must already exist.
Tip
Use the New-SPContentDatabase
cmdlet to quickly generate a new content database to move your site collection.
3.140.194.170