How to update Warning Site Count and Maximum Site Count of SPContentDatabase

This seems pretty simple as you can just set the properties of SPContentDatabase and you are good to go. However, this didn’t work atleast in my case.

I was trying to use the below command earlier which didn’t work:-

Get-SPContentDatabase | foreach-object{$_.WarningSiteCount = 0; $_.MaximumSiteCount=$_.CurrentSiteCount}

Ideally, if the above command executes successfully & correctly then it should update the Warning Site Collection Count to 0 and MaximumSiteCount to the CurrentSiteCount. The above command ran successfully without errors but there were some databases which didn’t reflect these changes.

So, I used the command Set-SPContentDatabase instead of modifying the properties directly. Below is the code which would do the same job and worked.

Get-SPContentDatabase | foreach-object{Set-SPContentDatabase -Identity $_.Id -WarningSiteCount 0 -MaximumSiteCount $_.CurrentSiteCount}

It seems like updating the properties directly didn’t work but using the command Set-SPContentDatabase did the magic. Hope this would help someone!

Advertisements

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 )

Google+ photo

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

Connecting to %s