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)In powershell, run the following command:
[backup path]
with the path where the backups should be written to e.g. c:\backups\
set-executionpolicy remotesignedThis 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"
E.g.
C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe powershellThe 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
"C:\Backups\Scripts\BackupSCOMMPs.ps1"
4 comments:
http://www.tek-tools.com/wordpress/
this obviously works... but why aren't you relying on something already more polished like the "Unsealed MP backup" solution that is here http://www.systemcentercentral.com/Downloads/DownloadsDetails/tabid/144/IndexID/7354/Default.aspx ?
@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 :)
when you use "export-managementpack", the sealed MPs are exported as XML anyway.
So what you need for those sealed MPs, is to keep a repository with your "source code", in all its versions, the needed references, and your signing key. And do a backup of THAT all.
if they are sealed, and you are referencing them, you will also need to re-seal them with THE SAME signing key...
Post a Comment