Here is the PowerShell script that I used for exporting (backuping) and importing (restoring) all "my site" site collections. This script could be used as an alternative to STSADM mergecontentdbs command which I found a little bit inflexible. I used this script for moving my sites to a different web application.
Exporting my sites:
$mysitesurl = "http://portal/my/personal/*"
$backuppath = "c:\MySitesBackup\"
$webapp = "http://portal"
Get-SPSite -WebApplication $webapp -Limit ALL | where { $_.Url -like $mysitesurl } | ForEach-Object{ $path = $backuppath + $_.Url.Substring($_.Url.LastIndexOf("/")+1); Backup-SPSite -Identity $_.Url -Path $path -Verbose }
Importing my sites:
$mysitesurl = "http://portal/my/personal/*"
$backuppath = "c:\MySitesBackup\"
$webapp = "http://portal"
Get-SPSite -WebApplication $webapp | where { $_.Url -like $mysitesurl } | ForEach-Object{ $path = $backuppath + $_.Url.Substring($_.Url.LastIndexOf("/")+1); Backup-SPSite -Identity $_.Url -Path $path -Verbose -Force }
Spared me alot of time - thanks!
ReplyDeleteMaybe I was a little to fast with the praise :)
ReplyDeleteYou need to change the Import part.
This works:
$mysitesurl = "http://portal/my/personal/"
$backuppath = "C:\MySitesBackup\"
$files = get-childitem $backuppath |
ForEach-object { restore-spsite ($mysitesurl + $_.Name) -path ($backuppath + $_.Name) -Confirm:$false -verbose}
After exploring a handful of the articles on your site,
ReplyDeleteI really appreciate your way of writing a blog.
I bookmarked it to my bookmark site list and will be checking back soon. Please check
out my website as well and tell me what you think.
my page - authentic green coffee