Rename a Service Application’s database using PowerShell

While setting up a SharePoint 2013 DR environment I needed to script the renaming of databases used by service applications.  Utilising the Get-SPServiceApplication cmdlet I was able to achieve this with just three lines:

$sa = Get-SPServiceApplication -Name "Managed Metadata Service"
$sa.Database.Name = "New_Database"
$sa.Update()

Rename_Database

Note: It was necessary to stop the service first using the Stop-SPServiceInstance cmdlet.

[BlogBookmark] [Blogsvine] [del.icio.us] [Digg] [Facebook] [Furl] [Google] [LinkedIn] [MySpace] [Reddit] [Slashdot] [StumbleUpon] [Twitter] [Windows Live] [Yahoo!] [Email]