just wondering what the powershell command would be that would allow me to get a list of all document libraries that have versioning turned off in our SharePoint Online site. We are working on implementing something but it requires that versioning is turned on, and while we check it is on now, it was not done by default when the site was first created.

3 Answers 3


Refer below Powershell Script. This will print all the lists/libraries with the versioning enabled or disabled. You can add a condition inside foreach to get only lists/librarie with versioning enabled.

$webUrl = Read-Host -Prompt "Enter URL : "
$username = Read-Host -Prompt "Enter User Name : "
$password = Read-Host -Prompt "Password for the user" -AsSecureString
$context = New-Object Microsoft.SharePoint.Client.ClientContext($webUrl)
$context.Credentials =New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username,$password)

$web = $context.web
$lists = $web.Lists

foreach($list in $lists)
    Write-Host "List Name : " $list.Title  " -- Is Versioning Enabled : " $list.EnableVersioning

Sharegate can find the libraries & lists with versioning disable and enable it in bulk for you.




That would be something like this:

( I would 'upgrade' it to PnP powershell if I should use it more than once)


  • Ok, I will stop providing answers while on the go if the purists insists Commented Mar 28, 2019 at 12:14

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.