Home > PowerShell, SharePoint 2010 > Upgrade All SharePoint 2010 Content Databases Using PowerShell

Upgrade All SharePoint 2010 Content Databases Using PowerShell

I recently blogged about how to upgrade your SharePoint 2010 Content Databases with Powershell when you see the status of the databases as such “Database is up to date, but some sites are not completely upgraded” http://jshidell.com/2011/08/16/sharepoint-2010-database-is-up-to-date-but-some-sites-are-not-completely-upgraded/

Now I wanted to be able to iterate through all the databases and update them all at once instead of having to manually update them one-by-one so I wrote a powershell script that goes through all databases and if an upgrade is needed it upgrades the database without any user interaction.

Below is the simple script you can use to accomplish this.

————————————————————————————————————————————————————————————-

$waDBs = Get-SPWebApplication -Identity <URL of WebApplication>

foreach ($contentDB in $waDBs.ContentDatabases)
{

Write-Host “Upgrading…..” $contentDB
Upgrade-SPContentDatabase -id $contentDB -Confirm:$false

}

$waDBs.Dispose()
iisreset/noforce

—————————————————————————————————————————————————————————————

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: