Tuesday, July 28, 2009

SCOM: backup management packs

A colleague of mine has created a script for backing up management packs in SCOM, as follows:

Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring
-Root: \
cd Monitoring:\
New-ManagementGroupConnection [rms]
cd [rms]

$all_mps = get-managementpack
foreach($mp in $all_mps)
export-managementpack -managementpack $mp -path "[backup path]"

Replace the following (including the brackets):

[rms]with the name of your RMS server (2 locations in script)
[backup path]
with the path where the backups should be written to e.g. c:\backups\
In powershell, run the following command:

set-executionpolicy remotesigned
This command sets your run permissions on your powershell scripts so you can run any locally created powershell script. Downloaded powershell scripts still need to be signed.

Save the script as a .ps1 file.

You can now schedule it through task scheduler as follows:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe powershell "full path to your powershell script, including the script name"


C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe powershell
The script will export all management packs, sealed and unsealed, creating an XML file for each. Currently, the script will overwrite any existing files in the location specified

1 comment:

Vanessa said...

@Daniele: the colleague who wrote the script created a couple of custom management packs and sealed them. He needed a way to back them up, and the Unsealed MP backup doesn't do it, because they are sealed.
The Unsealed MP backup is a great solution for unsealed MPs :)

Related Posts with Thumbnails