Loading the OpsMgr 2007 snap-in for OpsMgr 2012
Please note this was not an exhaustive test, if you are considering running OpsMgr 2007 scripts in an OpsMgr 2012 environment please do so in a lab setup to verify it works as expected before doing this in a production environment.
Well, I just tested this in a lab. Not that it is anything special, just thought I should note this as I did it to just make sure it works. The standard OM07 cmdlets seemed to work with out much trouble. When you load the OpsMgr 2012 console, the OpsMgr 2007 snap-in file is installed as well. You just need to tell PowerShell about it and that is only four lines of code.
Add-PSSnapIn Microsoft.EnterpriseManagement.OperationsManager.Client
cd \
cd "$env:c:\Program Files\System Center 2012\Operations Manager\Console"
.\Microsoft.EnterpriseManagement.OperationsManager.ClientShell.Startup.ps1
The first line loads the snap-in into PowerShell, the Second line changes the directory to the root, of the C drive in my case, the third line changes the directory to the location where the OpsMgr 07 startup file is located, the fourth line actually runs the startup file.
Great Scott!
My friend Ivan Hadzhiyski did it like this:
$Server = “scomms12.contoso.com”
Add-PSSnapin “Microsoft.EnterpriseManagement.OperationsManager.Client”
Set-Location “OperationsManagerMonitoring::”
New-ManagementGroupConnection `
–ConnectionString $Server
Set-location $Server
And of course that first line had the server name of a management server in it.
Hope it helps.
Thank you Bob!