The Script below will list the version status of every site in your farm.
Note that as the script is below, it only reports, you’ll need to uncomment 3 lines if you want it to make the changes.
It’s a good idea to run the script once or twice before you do that, so you have a log of what settings were.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue $timestamp = get-date -format "yyyMMdd_hhmmtt" $filenameprefix = "VersionScriptoutput" $logfile = ("{0}_{1}.csv" -f $filenameprefix, $timestamp) $header = "ListURL,Enabled" $header | out-file -filepath $logfile # tip - the script as is will pull every sharepoint site (at the IIS level) in your farm. # if you want to filter this to a single IIS site, # remove the # from the middle of the next line and enter your site's url $iissitelist = get-spwebapplication # | where {$_.url -eq "https://www.yoursite.com/"} foreach ($iissite in $iissitelist) { foreach ($SiteCollection in $iissite.sites) { write-host $SiteCollection -foregroundcolor Blue foreach ($oneweb in $SiteCollection.allwebs) { write-host $iissite.url $oneweb -foregroundcolor Green #now this is is where we look at the lists $lists = $oneweb.lists foreach ($list in $lists) { if($list.EnableVersioning -eq $false) { write-host $iissite.url $oneweb"/"$list"/ is a not using versions" -foregroundcolor yellow $msg = ("{0}/{1},false" -f $oneweb.url, $list.rootfolder) $msg | out-file -filepath $logfile -append # note! # if you actually want to make the changes, uncomment the next 3 lines! #$list.Enableversioning = $true #$List.MajorVersionLimit = 3 #$list.update() } else { Write-host $iissite.url $oneweb"/"$list"/ has versions enabled! " $msg = ("{0}/{1},true" -f $oneweb.url,$list.rootfolder) $msg | out-file -filepath $logfile -append } } } } } |
Pingback: Enable Versions on every SharePoint Site (updated with logging … | Mastering Sharepoint