I have enabled 10 major versions on all document libraries in my farm using the code below but I now need to exclude a few specific sites so that the major version number can be different to 10.
How would I go about adding that to this code?
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
#Disable creation of minor (draft) versions (document libraries only)
$list.EnableMinorVersions = $false
$list.MajorVersionLimit = 10
#$list.MajorWithMinorVersionsLimit = 5
$list.Update()
Write-Host $list.Title " is updated with MajorVersionLimit 10 "
}
}
}