Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $datS = get-date -Format "yyyyMMdd"
- $datF = get-date -Format "yyyyMMddHHmm"
- $backupDir = "C:\temp\$($datS)"
- if(-not $(Test-Path $backupDir)) {
- mkdir $backupDir
- }
- $waUrl = "http://contoso"
- $sites = Get-SPSite -Limit ALL -WebApplication $waUrl
- foreach($site in $sites){
- $urlStr = $site.RootWeb.ServerRelativeUrl.Replace("/", "_")
- $fname = "$($backupDir)\$($datF)$($urlStr).bak"
- backup-spsite -Identity $site.Url -Path $fname -Verbose -NoSiteLock -Confirm:$false
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement