Manage multiple Management Groups with PowerShell

Sometimes we have more than one Management Group (MG), production, test and maybe a development environment. When opening the Operations Manager Console it connects with the last MG you were connected to. This is controlled by the registry value SDKServiceMachine in HKEY_CURRENT_USER\Software\Microsoft\Microsoft Operations Manager\3.0\User Settings

If we want to control this, there is a switch when opening console:
Microsoft.MOM.UI.Console.exe /Server:OPSRMS01.opsmgr.se

image

So for the console we can create different shortcuts for the MG’s with the switch..

When it comes to the Operations Manager Shell there isn’t any switch to do it the “easy way”. I do like this:

First I makes as many copy’s of the file Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1 as I have Management Groups. Renaming them to the different MG names, for example:
Microsoft.EnterpriseManagement.OperationsManager.ClientShell.StartupOPSMGRdev.ps1 for my development environment.

Second I open the ..StartupOPSMGRdev.ps1-file in my preferred editor and change line 10

image

Just adding your RMS fqdn (remove : “”)

Third I make a copy of the Operations Manager Shell shortcut for every MG and change the .Startup.ps1 to the name you gave the Startup file, in my case it will be:
Microsoft.EnterpriseManagement.OperationsManager.ClientShell.StartupOPSMGRdev.ps1

image

So now I have a shortcut for every Management Group in my environment.

image

Update!
Cory Delamarter have written a post on the same subject but with an other angle.
Check it out here:
http://blogs.technet.com/b/corydelamarter/archive/2011/03/25/using-the-operations-manager-command-shell-against-multiple-management-groups.aspx

Written on March 5, 2011