Backup VMM 2008 R2 Using PowerShell

I just found a handy page with a Microsoft-written PowerShell script for backing up a System Center Virtual Machine Manager 2008 R2 database.

You start off by writing a script with two lines:

$VMMServer = Get-VMMServer -ComputerName "<<insert the FQDN of your VMM server here>>"

Backup-VMMServer –Path "D:VMMBackups" -VMMServer $VMMServer

In the MS example, you save that as C:MyScriptsBackupVMMDatabase.ps1. I’ve tweaked it so it backs up the database to the D: drive which is probably the library drive and (hopefully) has plenty of free space.

You can create a scheduled task to run the following command (one line) for VMM 2008 R2:

PowerShell.exe -PSConsoleFile "C:Program FilesMicrosoft System Center Virtual Machine Manager 2008 R2bincli.psc1" -Command ".’C:MyScriptsBackupVMMDatabase.ps1’"

Otherwise, you can do this by hand in the Administration view –> General, and clicking the Back Up Virtual Machine Manager task in the Actions pane.  You can also use a traditional SQL backup of the database.  And don’t forget to backup the library file share!

EDIT #1:

You will need to change the PowerShell script execution policy.  You can sign the script and se the policy to AllSigned.  Or you can set it to Unrestricted.

Technorati Tags: ,,,

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.