代码如下,请保存为人后辍名为ps1,用PowerShell来执行
$snapin = Get-PSSnapin | where-object { $_.Name -eq 'Microsoft.SharePoint.PowerShell' } if ($snapin -eq $null){ write-host "Loading SharePoint PowerShell Snapin..." -foregroundcolor Blue add-pssnapin "Microsoft.SharePoint.PowerShell" write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green } $File=Get-Date -Format "yyyyMMddHHmmss" $File="c:\Backup\84Port"+$File+".bak" Write-Host $File Backup-SPSite http://ssp:84 -Path $File