When Operations Manager has been up and running for a while, a couple of overrides MP’s are created that we don´t want to lose. Since there are no built-on function for this in Operations Manager, I wrote this script instead to make sure all my changes made are safely backed up on a regular basis.
So what does the script do?
The script looks after all unsealed Management Packs and then exports them to a file-path that´s specified in the script. Then the script can schedule by using Task Scheduler. It needs a folder to run in, e.g. E:\Backup.
How to use the script
The script is shown below and the only thing that needs to be changed before executing the script is the file-path, which is bold in the text below. Copy the script below and paste it into notepad before saving it as "Export.PS1"
param($ManagementServer) Import-Module OperationsManager New-SCOMManagementGroupConnection -ComputerName $ManagementServer $Date = Get-Date -Format "yyyy-MM-dd" $TodaysFolder = "E:\Backup\" + $Date New-Item $TodaysFolder -ItemType directory -Force $mp = Get-SCOMManagementPack | where {$_.Sealed -like "False"} Export-SCOMManagementPack -ManagementPack $mp -Path $TodaysFolder Set-Location -Path $TodaysFolder
Create a new task by using Windows Task Scheduler and follow these steps
-Command "& E:\Backup\ManagementPacks\Export.ps1 -ServerName 'YourManagementServer' ; exit $LASTEXITCODE"
Click OK two times and enter the password for the service account to create the task. Now when the task is created, you can test run the task by right clicking it and choose “Run”. Now, check the folder you created earlier and your unsealed management packs should now be exported to a folder matching today's date. Wrap Up This script is very easy to use and it makes the backup process completely automatic, something that at least makes me calm knowing that my changes in rules, monitors and overrides are safe.
Now when the task is created, you can test run the task by right clicking it and choose “Run”. Now, check the folder you created earlier and your unsealed management packs should now be exported to a folder matching today's date.
Wrap Up
This script is very easy to use and it makes the backup process completely automatic, something that at least makes me calm knowing that my changes in rules, monitors and overrides are safe.
Thanks for share.