OpsMgr – How to move an override


This is a question I’ve been asked many times from my operators. They created an override in the wrong management pack, maybe even in the default management pack, and they want to set it right. I checked the net and I didn’t find a complete step by step guide for such a simple and common task, so here it is.

First of all, misplaced overrides can cause several subtle issues:

  1. since the minimum granularity for rules distribution to agents is the management pack, misplacing an override can cause an increased load even on agents that are not monitoring that specific class. For example if we use a single management pack for all our overrides, at every new or updated override the whole management pack will be distributed to all agents and reloaded (21025 event)
  2. before dismissing a management pack the references to that management pack must removed first. If we have a 1:1 relationship between the sealed MP and the overrides MP then it’s easy to delete the couple, but if overrides get messed up we have to edit the override management pack to remove all the references.

The basic steps for moving an override are:

  1. delete the old override
  2. recreate the override, setting the correct management pack
  3. clean up the management pack where you first created the override from any reference

Step 1 and 2 can be collapsed into one operation using Boris’s OverrideExplorer (it will soon be ported to OpsMgr 2012 by Daniele Muscetta).

Step 3 can be done manually. To do this you need to export the MP and edit it with your favorite editor (notepad is more than ok for this simple task), then you need to identity in the <References> section the correct one and delete it (from <Reference> to </Reference>:

image

Once you did, just save and reimport the Management Pack. If you did your job well then the Management Pack will import without errors. If you get errors you can hit just two issues:

  1. you didn’t properly deleted the reference, maybe deleting too much or leaving some string inplace
  2. you didn’t delete all the overrides that were using such a reference

In both case nothing is lost, your import just didn’t get through and nothing has changed. So open once again the MP and do your job right Smile.

Obviously there’s another way to perform the same thing via the SDK, this could prove to be a small project on its own, the code should:

  • list all the overrides (OverrideExplorer does this)
  • give the ability to cut / paste an override (OverrideExplorer does this)
  • check what was referenced by the old override (not so complicated even if different type of overrides need to be managed)
  • check if those references are in use in the MP (I fear this could prove to be cumbersome since there’s no native method to do this, nor to access the raw MP xml)
  • if they’re not in use anymore remove them

Just to check if this is something that can be achieved in few hours I took a look at the SDK, but as I stated before it needs time. Anyway if you know your reference is not used anywhere else in the source management pack you can use the following powershell code:

$mp = Get-SCManagementPack | where {$_.Name -eq ‘my override mp’}

$r = $mp.references | where {$_.Name -eq ‘referenced MP system name ex.Microsoft.Windows.DNSServer.2008’}

$alias = $mp.References.GetAlias($r)

$mp.References.Remove($alias) $mp.TryAcceptChanges()

More info here: http://msdn.microsoft.com/en-us/library/microsoft.enterprisemanagement.configuration.managementpackreferencecollection_members.aspx

– Daniele

This posting is provided “AS IS” with no warranties, and confers no rights.

Advertisements
  1. #1 by Daniele Muscetta on February 24, 2012 - 4:59 pm

    Daniele, I posted updated versions of Boris’s tools here just a couple of days ago http://blogs.msdn.com/b/dmuscett/archive/2012/02/19/boris-s-tools-updated.aspx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: