Enabling versioning on all document libraries in a site collection or disabling versioning is often quite useful.

Write-Host Loading the SharePoint Powershell Snapin
<h1>Load Snapins</h1>
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}

Write-Host "Starting to update lists and Libraries"

$webs = get-spsite http://intranet.domain.com | get-spweb -Limit All
foreach ($web in $webs)
{
Write-Host "Updating Site" $web -foregroundcolor Black -backgroundcolor Yellow
foreach ($list in $web.lists)
{
Write-Host "Looking at list $list"

if ($list.BaseType -eq "DocumentLibrary" -and $list.BaseTemplate -eq "DocumentLibrary")
{
Write-Host "Updating list $list" -foregroundcolor Black -backgroundcolor Green
$list.EnableVersioning = $true;
$list.EnableMinorVersions = $false;
$list.EnableModeration = $false;
$list.MajorVersionLimit = 0;
$list.ForceCheckout = $false;
$list.Update()
}
}
$web.Dispose()
}
Write-Host "Done updating lists!" -foregroundcolor Black -backgroundcolor Green

Source


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.