Get started Bring yourself up to speed with our introductory content.

Backing up management packs in System Center Operations Manager 2007

This excerpt from "System Center Operations Manager 2007 Unleashed" guides you through the process of backing up management packs as separate objects in SCOM 2007, which allows you to restore a specific management pack rather than the entire database.

System Center Operations Manager 2007 UnleashedThis chapter excerpt from System Center Operations Manager 2007 Unleashed, by Kerrie Meyler, Cameron Fuller, John Joyner and Andy Dominey, is printed with permission from Sams Publishing, Copyright 2008.

Click here for the chapter download or purchase the entire book here.

It is just as important to back up modifications to management packs as it is to back up the SQL Server databases used by Operations Manager. All overrides and custom rules in monitors are saved to a user-specified unsealed management pack stored in the Operational database. Backing up and maintaining management packs as separate objects gives you the granularity to restore a specific management pack rather than the entire database. You may want to create a separate management pack to store your overrides for each of the various management packs. Microsoft provides an unsealed management pack, named Default, where you may also be storing changes (although this is typically not recommended).

You can back up (export) unsealed management packs in an ad-hoc manner using the Operations console. We discuss this technique in Chapter 13, "Administering Management Packs." For purposes of regularly scheduled backup jobs, we suggest that you back up your unsealed management packs in a batch mode, using PowerShell cmdlets to export the management packs from the RMS.

Implementing a Full Change Control Process

A good change control process will include backing up management packs and storing them in a code repository solution.

Microsoft's PowerShell command-line shell is a new scripting language, allowing IT professionals to more easily control system administration. PowerShell is included with Windows Server 2008, Exchange Server 2007, and Operations Manager 2007. The Operations Manager Command Shell is a customized instance of PowerShell; it is a superset of PowerShell with cmdlets specific to OpsMgr functions. You can make OpsMgr SDK calls using the Command Shell.

Chapter 8, "Configuring and Using Operations Manager 2007," included a PowerShell example of importing management packs. In this chapter, we will export management packs using the export-managementpack PowerShell cmdlet.

Microsoft helps make the cmdlet easy to use by giving us a syntax example when you type get-help for this cmdlet. The example will export all unsealed management packs ($_ .Sealed –eq $false) to the root of the C: \drive:

$mps = get-managementpack ¦ where-object {$_.Sealed -eq $false}
foreach($mp in $mps)
export-managementpack -managementpack $mp -path "C:\"

To put this syntax in a script, perform the following steps:

  1. Open Windows Notepad and add code that initiates a connection to the RMS and loads the OpsMgr PowerShell extensions:
    param ($ServerName)
    set-location "OperationsManagerMonitoring::";
    new-managementGroupConnection -ConnectionString:$ServerName;
    set-location $ServerName;

    Because we are loading the OpsMgr extensions, we can run our script from the standard PowerShell environment, without having to run from inside the OpsMgr Command Shell. This is useful if you want to run scripts in a batch mode.

  2. Now, add the original code from our get-help example, modified to export the management packs to C:\backups:
    $mps = get-managementpack ¦ where-object {$_.Sealed-eq $false}
    foreach($mp in $mps)
    export-managementpack -managementpack $mp -path"C:\backups"
  3. Save the text file with a .ps1 extension for it to be executable by PowerShell. Figure 12.18 shows Notepad open to the ExportMP.ps1 PowerShell script we created to export all unsealed management packs.

To run the script shown in Figure 12.18 (saved as Z:\ExportMP.ps1), perform the following commands: Start → Run 62; CMD, then type PowerShell. This opens a PowerShell instance.

FIGURE 12.18

From the PowerShell prompt, type the following, specifying the RMS for the ServerName variable:

Z:\ExportMP.ps1 –ServerName:<rootmgmtserver>

How the ExportMP PowerShell Script Works

The script looks for the SDK service, which runs on the RMS only. If the RMS is not properly specified as the –ServerName value, you will receive the following error:

New-ManagementGroupConnection : The sdk service is either not running or not yet initialized.

If you attempt to run the script from the same directory it is located, be sure to prepend the script name with a "\." . For this particular example, the script name would be typed .\ExportMP.ps1.

Another Approach for Exporting Management Packs

If you want to back up management packs associated with a certain application or service, you can use the following PowerShell Script as a starting point. This example, which also uses the export-managementpack cmdlet, searches for management pack names that include the literal "AD" and then exports all management packs (sealed or unsealed) related to Active Directory:

param ($ServerName)
add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";
set-location "OperationsManagerMonitoring::";
new-managementGroupConnection -ConnectionString:$ServerName;
set-location $ServerName;
$ mps = Get-ManagementPack ¦ where{$_.Name -match 'AD'}
=foreach($mp in $ad_mps)
export-managementpack -ManagementPack:$mp -Path:"c:\backups"

When you run this script, you will notice that all exported management packs have an extension of .xml—even the sealed ones. This is by design. Microsoft created sealed management packs (MPs) so you will not edit directly into the management pack; the vast majority of support calls for MOM 2005 were from problems with customers changing something inside of a management pack. With sealed MPs, you must use overrides to change rules and monitors, and those overrides are stored separately from the sealed MP.

Save the preceding code to a file with a .ps1 extension, open a PowerShell instance: Start - > Run > and type CMD, and then type PowerShell. Run the script by typing the following command:

Z:\mpexportAD.ps1 -ServerName:<rootmgmtserver>

You can build on this example to develop other customized export scripts.

Backing Up Management Packs from a Batch File

Now, let's take it one more step. We can create a batch file that invokes a PowerShell script, which can be part of a nightly backup routine. We will save our ExportMP.ps1 script to our c:\backups directory, and execute it from a batch file containing the following command:

%systemroot%\system32windowspowershell\v1.0\powershell.exe c:\Backups\exportMP.ps1-ServerName:<rootmanagmentserver>

The command invokes the PowerShell environment and runs our PowerShell export script. Running this nightly ensures that all customized management packs are extracted to the file system on a regular basis, where they can then be backed up to tape as part of your standard backup process.

Using the Operations Console

Chapter 13 discusses exporting and importing management packs. The functionality can also be used as part of your backup strategy. This chapter focuses on those steps of particular significance when backing up management packs.

The Operations console only allows you to export unsealed management packs. To use the Operations console to back up and restore management packs, perform the following steps:

  1. In the Administration node of the Operations console, right-click on the specified management pack in the Details pane to bring up the option to Export Management Pack, shown in Figure 12.19 (for sealed management packs, this option is grayedout). This option is also available in the Actions pane, although it is grayed-out unless you have highlighted an unsealed management pack.

    We will back up (export) the Default management pack, which is where all management pack changes are saved, by default.

  2. You are asked to browse to the folder where the exported management pack will be saved. Figure 12.20 shows that we will export the Default management pack to the C:\backups folder. We are not given the option to specify a filename.

    FIGURE 12.19

    FIGURE 12.20

  3. If the management pack has already been exported to that folder, you are asked if you want to overwrite it (see Figure 12.21). If you choose No, the management pack is not exported and you are not given an option to save to another filename or folder.
  4. Successfully exporting the management pack brings up the message displayed in Figure 12.22.

Restoring the management pack using the Operations console is accomplished using the Import function discussed in Chapter 13.

FIGURE 12.21

FIGURE 12.22


 Tip 1: Roles of key SCOM files and databases
 Tip Establishing a backup schedule/a>
 Tip 3: Database grooming
 Tip RMS backup and recovery/a>
 Tip 5: Backing up management packs
Backing p reports
 Tip 7: Disaster recovery planning/a>

Dig Deeper on Windows Server storage management