Is it possible to enable versioning on all lists and libraries across all web sites of a site collection? Thanks.

2 Answers 2


Sure. Here is a script that can do it. Replace $siteURL with your site's url.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
$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
            Write-Host "MinorVersioning Enabled: " $list.EnableMinorVersions
            Write-Host "EnableModeration: " $list.EnableModeration
            Write-Host "Major Versions: " $list.MajorVersionLimit
            Write-Host "Minor Versions: " $list.MajorWithMinorVersionsLimit
            $list.EnableVersioning = $true
            $list.EnableMinorVersions = $true
            $list.MajorVersionLimit = 2
            $list.MajorWithMinorVersionsLimit = 5
            Write-Host $list.Title " is updated with MajorVersionLimit 2 and MajorwithMinorVersionsLimit = 5"

You can read more here:



I know it's been 3 years ago and already answered, but here you can find plenty of versioning scripts and ready programs:
Disable a versioning on Image Libraries in SharePoint using PowerShell
Enable versioning for all SharePoint Online lists using Powershell
Enable versioning for all lists in SharePoint Online tenant (C#)
Restore and clean up SharePoint versions
Enable minor versions for all SharePoint Online lists using Powershell

The scripts/codes are usually published, so you can adapt them to your needs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.