SCOM 2012 R2 – Export Management Pack every Day

I will today try to explain what you need to export all management pack every day.  It can be usefull if like to take backup, or just like have all version of the management packs.

When you use powershell and Task Schedule you can setup an export of the management packs every day.

Below you can find a script to export all management pack to file location. It have the befix that you normal file backup can take backup of the management packs.

The machine that execute the script need to hace powershell for Operations installed. You also need to know where to export the management packs to(Path), ex. C:\Export\ExportMP. Save the below script as ExportMPs.ps1, ex C:\Script\ExportMPs.ps1.

#Powershell Script Start

# AUTHOR: Christian Jacobsen
# DATE: 16/06/2014
# Name: ExportMPs.ps1
# Version: 1.0
# COMMENT: Export Management Pack to file location
# How To: Change the value for the Path in line 14, to the location you like

#Initiate SCOM PSSnapin
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client -ErrorAction SilentlyContinue -ErrorVariable Err

#Export Sealed MPs
Get-SCOMManagementPack -Name * | Export-SCOMManagementPack -Path “C:\Export\ExportMP”

#Powershell Script End

When you have done the above, then is time to create Scheduled Task in Task Scheduler.

  • Open Task Scheduler
  • Create a New Task
  • Give it name, and set to run whether a user is log on or not
  • Create a new Trigger, set it to run every day
  • Create a new Action, Program = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe and with the paramenter = C:\Script\ExportMPs.ps1
  • Save it
  • Test it, use Run Now

Now you have create a dayli ‘Backup’ of your MP’s.



Comments are closed.