There are many different solutions out on the web for backing up unsealed management packs in Operations Manager. Most of these involved storing the backups on a share somewhere and usually still required manual intervention.
After using (and loving) the new Visual Studio Authoring Extensions I began to think about how I can get my unsealed MPs in TFS as well. This would then give me a one stop shop for all the management packs used in my environments. It would also give me an easy way to view the changes that were made.
The result of my daydreaming (and work!) is the below script.
This PowerShell script (although some might call it “C# in PS”) will sync any unsealed Management Packs to a folder in TFS. It works by exporting all unsealed MPs and then checking TFS for differences. It will do adds, edits, and deletes in TFS and check-in all pending changes.
This PowerShell script must be run on a server with the following installed:
- Team Foundation Server 2012 SP1 Object Model
- SCOM 2012 Operations Console
Script is at the bottom of this post
First things first, you will have to configure the script with the details of your environment…
|$TfsUrl||URL to the TFS instance which will be used. This can be found by connected to TFS and viewing the properties of it in Visual Studio Team Explorer||http://servername:8080/tfs/projectcollection|
|$TfsFolder||Folder in TFS where the MPs will be stored||$/Monitoring/SCOM/Management Packs/Unsealed Management Packs|
|$ManagementServerName||The FQDN of any management server in the management group||CONTOSOMS01.contoso.corp.com|
With that you should be good to go! The script does drop events which can be tracked. Down the road, Ill share a management pack for alerting on any issues.
Also, check back in the future for a post on the V2 version of this (Hint – This would make a nice custom Activity in an Orchestrator Integration Pack… )
Please provide any feedback on the script in the comments below. I’m always one to give credit to others for finding bugs or providing improvements.
This posting is provided “AS IS” with no warranties, and confers no rights. Use of included utilities are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm