Blog
By Andreas Zuckerhut on 7/9/2010 5:19:58 AM • Rank (2372) • Views 2509
2

2

Important: Consider this script as BETA! I will not take responsibility for any damage this script might cause due to unforseen behaviour.

NOTE: I will rephrase this and add an Example with shiny screenshots once I find time for it.

So,

how, what and why would I write this?


Why?

I had several reasons but basically there is nothing more boring than creating overrides for Management Packs one by one. It's a time consuming, mind-numbing process that I prefer to solve by running a script.

And since I was already planning it, I thought I'd create a very generic one.


Example:

We only react to alerts that have a High Priority. So, when we import a new Management Pack like the SQL Management Pack we'd have to override the Priority of Alerts one by one until the ones we don't want to see are gone.

So I thought: Instead of doing this over and over for each Management Pack we just pre-override the Alerts to Medium and only activate the ones we really want to see.


How:

In the script you can find attached to this Blog you see the following Properties at the Top:

 - OverrideMPDisplayName (Display Name of the MP in which you store the Overrides. Only alpha-numerical)

 - FilePath (Folder in which you drop the Management Pack)

 - MPNames (Name of an MP or a list of names separated by a semicolon ; )

 - OverridePropertyName (Name of the Property you want to Override)

 - OverrideValue (Value for the Override)

 - RootManagementServer (name of the RMS)


Step 1: Loading/Creating the Override Management Pack

I decided to write the Management Pack to some folder instead of writing it directly into the Operations Manager.

So what I do is, I take the OverrideMPDisplayName and create an MPName (Removing Spaces) for it. I then check if it already exists in the folder you configured in FilePath.

In case it does, I load it, in case it doesn't, I create a new one. So, if you want to create overrides for various values you can just use the same Target MP over and over.


Step 2: Creating Overrides for each Management Pack

I load each Management Pack you provided from the RMS and check if it's sealed, if it's not, I can't create an Override for it and skip it.

If everything is fine, I add a Reference to the currently processed MP in the Overrides MP.

I then iterate through each rule/monitor and check if the OverridePropertyName you provided is overrideable on it. If yes, I create an Override, otherwise I skip it.


Step 3: Save the Management Pack

When everything is finished, I save the Management Pack to your Filepath with the MPName I created for it. It's the Displayname without spaces, file ending is .xml.


Note:

I tested this with the Exchange 2010 Management Pack and when it says "Writing Management Pack..." it will stay there for quite some time. Actually, it takes ages. It has to verify each Override first, otherwise it won't let you save the MP (that's per default).
 

Latest Media - View All Media (1)
   
Read More
Comments (5) - Comment RSS
Fabrice GASNIER wrote: on Dec 29, 2010 10:05 AM
Well it was almost what I was searching for, but as I am a total Rookie in PShell I need you to troubleshot my little changes.



My goal was to rise up the alertpriority, so I changed the first lines as





$OverrideMPDisplayName = "AD_2008_Alert-High"

$FilePath = "E:\temp\MP\MPAD"

$MPNames = "Microsoft.Windows.Server.AD.2008.Monitoring"

$OverridePropertyName = "AlertPriority"

$OverrideValue = "High"



but when i ran the script, it gets many errors like :



Error in function Load-OperationsManagerEnvironment #1 : Exception calling .ctor with 2 argument(s): The ManagementPack parameter to this constructor cannot be null.





What is this .ctor thing ???
Fabrice GASNIER wrote: on Dec 29, 2010 10:11 AM
Sorry, something goes wrong with the quotes :(
shadowman wrote: on Sep 24, 2011 01:13 PM
@Andreas Zuckerhut, do you also know how create a script that creates overrides in a certain management pack using a input file (text file)
Sitaram Pamarthi wrote: on Oct 24, 2011 05:05 AM
I am also getting the same error that "Fabrice GASNIER " reported. What is the solution here?
Andreas Zuckerhut wrote: on Oct 24, 2011 07:41 AM
I guess you ran into the same issue as Fabrice, you used a "-" sign or something else in the Displayname? That will cause issues, please only use alphanumerical chars and "_" and ".", anything else will cause trouble.


Who Viewed
Who Reviewed
Categories
Related Pages
Shortened URL
http://tinyurl.com/35lngdb

Top Contributors
Featured Members
Pete Zerger
Points: 65622
Level: System Center Expert
Tommy Gunn
Points: 42748
Level: System Center Expert
Simon Skinner
Points: 40804
Level: System Center Expert
Stefan Koell
Points: 28999
Level: System Center Expert
Andreas Zuckerhut
Points: 27734
Level: System Center Expert