启用SharePoint 2013文档版本控制

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"
            }
        }
    }
}

你可能感兴趣的:(SharePoint)