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")
# if($list.BaseType -eq "GenericList") for List calenar task.
{
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
$list.Update()
Write-Host $list.Title " is updated with MajorVersionLimit 2 and MajorwithMinorVersionsLimit = 5"
}
}
}
No comments:
Post a Comment