Hi There!
At a client of mine recently they wanted to have site level backups created on a nightly basis. I decided to use PowerShell and Windows Task Scheduler to perform this tasks. Creating the PowerShell scripts was easy enough, see below:
First set execution policy
Set-ExecutionPolicy “Unrestricted”
Next, add the PowerShell snapin for SharePoint
Add-PSSnapin microsoft.sharepoint.powershell
Lastly, export each targeted site as follows:
Export-SPWeb –Identity http://serverName/siteName –Path d:backupssiteName.bak –force –IncludeUserSecurity
The finished product is below:
Set-ExecutionPolicy “Unrestricted”
Next, add the PowerShell snapin for SharePoint
Add-PSSnapin microsoft.sharepoint.powershell
Export-SPWeb –Identity http://serverName/siteName –Path d:backupssiteName.bak –force –IncludeUserSecurity
Save these commands in a .ps1 file. I will call mine backupSitesTest.ps1.
Create the Task in Task Scheduler:
Create a basic task with the following settings for the Actions Tab:
For Program/Script, type powershell.exe
For Add arguments (optional), specify the following: -command d:scriptDirectorybackupSitesTest.ps1
Then add a schedule and you’re done.