In System Center Operations Manager SCOM 2007 R2 i wanted to run a script. When running the script in PowerShell i got the following error:
The term ‘Get-ManagementServer’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I ran a script that was posted on a Microsoft Technet site so it had to be good. Then why doesn’t it work?
This is the script i was running:
$newMS = Get-ManagementServer | where {$_.Name –eq ‘<SecondaryMgmtServer.DomainName.COM>’}
$agent = Get-Agent | where {$_.PrincipalName –eq ‘<AgentComputer.Domain.COM>’}
Set-ManagementServer -AgentManagedComputer: $agent -PrimaryManagementServer: $newMS
The solution was really simple: Use the correct PowerShell!
When installing software that can make use of PowerShell it often comes with a specific PowerShell. In this case that’s the SCOM 2007 Operations Manager Shell. No need to run it as an administrator. That results in a window that will never pop up. Just click it, wait a bit until the connection with a management server has been made and you are good to go!
I made this post because i noticed this wasn’t on the internet as a whole solution. And since i made a mistake using the wrong PowerShell (it was Monday morning..) i thought it would be nice to make this a blogpost about it.
I hope this was informative for you.
If you like this post please support phits.nl. Thanks!


