I’ve got a Resource Pool for Windows servers with two management servers in. The primary management server for my windows agents is either one or the other of those two management servers in the Resource Pool, however, the secondary management server can be any of my other four management servers. I want to set the secondary for Windows agents to be the other server in the Windows server resource pool. Hope that makes sense. Does the below PS look like it will do the job? I’ve run it in Dev, but I’ve only got two management servers there anyway! It didn’t break anything at least…
$agents = get-scomagent | where {$_.PrimaryManagementServerName -eq “SCOM01.madeup.com”}
Yup your script should work - I’ve tidied it up a bit below just to make it a bit easier to enter going forward (you’ll need to run this again when you’ve added more agents in the future).
Note for anyone who making changes to primary/failover management servers: the changes are sent to your agent via it’s management server, but they will usually receive and process the configuration change first. If an agent’s current MS (or one of the failovers) is not a new primary or failover server, it will very likely get locked out of the SCOM environment as it won’t know it now needs to communicate with a new management server and the previous ones will refuse to communicate with it.
Have a look at Tao Yang’s OPS Manager Self Maintenance management pack.
I used to use similar script to what you have above, until I discovered this pack. It will do this and many other useful things on schedule. I have mine set to run every night, and not only set the failover, but also balance the agents evenly between the management servers. It’s brilliant and saves you maintaining a script.
Am I reading this right if I think that you have one resource pool with two management servers. And then another resourcepool with four servers?
And you want half of the clients to be targeted at MGMTpool1-server1 and the other half targeted at the other five?
Your script looks correct for changing management server.
I’ve got a resource pool of 2 management servers for Windows Servers, I want the clients in there to failover between those two management servers only. The other 4 management servers are a pair in a resource pool for *NIX clients and a pair in a resource pool for specific servers in Trust - I don’t want these to be secondary failover servers for the agents in the Windows Server resource pool.
I do use the MP for balancing the agents between Management servers, but not for setting the secondary failover; I’ll have to take another look at it. Thanks,.