cls
$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
$webAppUrl = Read-Host
$WebApp = Get-SPWebApplication $webAppUrl
Foreach ($SiteColl in $WebApp.Sites)
{
$rootSite = Get-SPSite $SiteColl.Url
$allWebs = $rootSite.AllWebs
foreach ($web in $allWebs)
{
$lists = $web.lists
foreach ($list in $lists)
{
# $list.EnableVersioning = $false
# $list.update()
if($list.EnableMinorVersions -eq $false)
{
# write-host $list.title "is a not using versions"
if($list.BaseType -eq "DocumentLibrary")
{
write-host $list.title "is a not using versions"
$list.EnableMinorVersions = $true
$list.update()
}
}
else
{
$list.EnableMinorVersions = $false
$list.update()
#Write-host $list.title " is set for up to " $list.MajorVersionLimit "previous versions"
}
}
}
}