PowerShell script to backup unsealed SCOM MPs

less than 1 minute read

Not sure if anyone has written this before. I have written this simple script to backup all unsealed management packs.

I have scheduled it to run daily on RMS via Windows Task Scheduler.

How does it work:

  1. Backup unsealed MPs to a local folder.
  2. Delete older backups from local folder
  3. robocopy backup from local folder to a remote location using purge option (Anything that not exist from source will be deleted from destination. Therefore old backups are deleted from remote folder as well.)

Preparing the script:

Modify line 21-23 to suit your environment

image

$backuproot – local folder where MPs are backed up to.

$remoteLocation – Remote location where backups are robocopied to.

$daysToKeep – retention period

Finally, make sure you the account scheduled task runs under has appropriate rights in SCOM.

Download the script HERE.

Leave a comment