Powershell script to enable version on all document libraries(other than catalogs and hidden libraries):
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
  1. $siteURL = "<<your site URL>>"
  2. $site = Get - SPSite($siteURL)
  3. foreach($web in $site.AllWebs) {
  4. Write - Host "Inspecting "
  5. $web.Title
  6. foreach($list in $web.Lists) {
  7. if (($list.BaseType - eq "DocumentLibrary") - and($list.IsCatalog - eq $false)) {
  8. If(($list.EnableVersioning - eq $false) - and($list.hidden - eq $false)) {
  9. If(($list.Title - ne "Style Library") - and($list.Title - ne "Form Templates")) {
  10. Write - Host "Versioning enabled: "
  11. $list.EnableVersioning
  12. $host.UI.WriteLine()
  13. Write - Host "Major Versions: "
  14. $list.MajorVersionLimit
  15. $host.UI.WriteLine()
  16. $list.EnableVersioning = $true
  17. $list.MajorVersionLimit = << your value >>
  18. $list.Update()
  19. Write - Host $list.Title " is updated with MajorVersionLimit"
  20. }
  21. }
  22. }
  23. }
  24. }