Enable versioning on all lists and libraries

Copied from: https://social.technet.microsoft.com/Forums/office/en-US/2d82272d-9aea-453a-b2ae-bf7df55a0304/automatically-enable-versioning-on-all-document-libraries?forum=sharepointadminprevious


There is no OOTB feature to do this but below mentioned powershell script will enable it on all existing sites:
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$siteURL = $args[0]
$site = Get-SPSite($siteURL)
foreach($web in $site.AllWebs) {
 Write-Host "Inspecting " $web.Title
 foreach ($list in $web.Lists) {
 if($list.BaseType -eq "DocumentLibrary") {
 Write-Host "Versioning enabled: " $list.EnableVersioning
 $host.UI.WriteLine()
 Write-Host "MinorVersioning Enabled: " $list.EnableMinorVersions
 $host.UI.WriteLine()
 Write-Host "EnableModeration: " $list.EnableModeration
 $host.UI.WriteLine()
 Write-Host "Major Versions: " $list.MajorVersionLimit
 $host.UI.WriteLine()
 Write-Host "Minor Versions: " $list.MajorWithMinorVersionsLimit
 $host.UI.WriteLine()
 $list.EnableVersioning = $true
 $list.EnableMinorVersions = $true
 $list.MajorVersionLimit = 2
 $list.MajorWithMinorVersionsLimit = 5
 $list.Update()
 Write-Host $list.Title " is updated with MajorVersionLimit 2 and MajorwithMinorVersionsLimit = 5"
 }
 }
}

Plus check this blog , you can use similar code on SP2010
http://mkdot.net/blogs/boban/archive/2008/07/22/turn-on-versioning-on-sharepoint-document-library.aspx

also refer to:
http://technet.microsoft.com/en-us/magazine/ff956106.aspx
 

Comments

Popular posts from this blog

Configure SharePoint Server to use Office Online Server

PowerShell command to import Module and Get-ADUser

Configure Office Web Apps for SharePoint 2013