PowerShell script to backup all SharePoint 2010 lists in all webs in all sites

More backups the better. I wanted a file level backup of every list. Below I used PowerShell to iterate through all the lists on the server and dump them into a folder

$backupDir="c:\Temp"
foreach ($web in $(Get-SPSite | Get-SPWeb)){
	foreach ($list in $web.Lists) {
	mkdir -force "$backupDir\$($Web.Title.replace(' ',''))\"
	Export-SPWeb $($web.Url) -itemurl "$($list.RootFolder.ServerRelativeUrl)" -path "$backupDir\$($Web.Title.replace(' ',''))\$($list.Title.replace(' ','')).cmp"
	}
}

,

Comments are closed.