Lockout Content Database for Migration

Below is a basic script to lockout Content Database for new site collections.  It sets the max to current sites count and warning to less than 1 of count.  May help someone.

$ALLDB = Get-SPContentDatabase
foreach($DB in $ALLDB)
    $Count = $DB.Sites.Count
    if($Count -gt 0)
        $CountWarnining = $Count – 1
        Set-SPContentDatabase $DB.Name -MaxSiteCount $Count -WarningSiteCount $CountWarnining

Get-SPContentDatabase | Select Name, Current*, Max*, WarningSiteCount | Out-GridView

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s