MP Backup


Here is a script that I wrote last night to demonstrate how you can implement a simple MP backup process. The goal is to allow you to backup unsealed MPs so that if you make a mistake you can go back to the good copy. You can also schedule this script to run on a daily basis using Task Scheduler.


Here is how you can run the script from the command line:


powershell.exe C:\BackupMPs.ps1 -rmsName:’rms.contoso.com’ -folderName:’c:\Backups’

BackupMPs.ps1


Comments (4)

  1. Sven Wells says:

    Hi,

    Great script, but I have one issue.  It seems if I try to run it on a computer other than the actual RMS, it fails with the message:

    Add-PSSnapin : No Windows PowerShell Snap-ins are available for version 1.

    At D:BackupMPs.ps1:10 char:13

    • add-pssnapin  <<<< "Microsoft.EnterpriseManagement.OperationsManager.Clie

    Set-Location : Cannot find a provider with name ‘OperationsManagerMonitorin

    At D:BackupMPs.ps1:11 char:13

    • Set-Location  <<<< "OperationsManagerMonitoring::";

    The term ‘New-ManagementGroupConnection’ is not recognized as a cmdlet, fun

    n, operable program, or script file. Verify the term and try again.

    At D:BackupMPs.ps1:12 char:40

    • $mgConn = New-ManagementGroupConnection  <<<< -connectionString:$rmsName;

    The non-RMS server I am trying this on is the Datawarehouse server, which has the capacity to hold all my backup files, ie. sql db backups.

    Any ideas?

    Thanks,

    Sven

  2. borisyan says:

    The script is written such that it will run on computers other than the RMS. However, the computer on which you are running the script needs to have the Console and the OpsMgr Command Shell installed.

  3. Check out Boris Yanushpolsky&#39;s blog ( http://blogs.msdn.com/boris_yanushpolsky ). Boris is an SCOM

  4. billmc@microsoft.com says:

    To automate via sheduled tasks

    here is how below

    1. Start powershell command prompt
    2. Set-executionpolicy remotesigned

    3. Use get-executionpolicy to check

    4. Copy the backupmps.ps1 script to a directory on the server. I used c:backupmps

    5. Create a scheduled task to start powershell

      for example

    Command line   is C:WINDOWSsystem32WindowsPowerShellv1.0powershell.exe c:backupmpsbackupmps.ps1 -rmsname:’billmcdell’ -foldername:’c:backupmps’

    Start directory in is the same c:windowssystem32windowspowershell1.0