0

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”}

$pri = get-scommanagementserver | where-object {$_.PrincipalName -eq “SCOM01.madeup.com”}

$sec = get-scommanagementserver | where-object {$_.PrincipalName -eq “SCOM02.madeup.com”}

Set-SCOMParentManagementServer $Agents $_ -PrimaryServer $pri;

Set-SCOMParentManagementServer $Agents $_ -FailoverServer $sec

and then:

$agents = get-scomagent | where {$_.PrimaryManagementServerName -eq “SCOM02.madeup.com”}

$pri = get-scommanagementserver | where-object {$_.PrincipalName -eq “SCOM02.madeup.com”}

$sec = get-scommanagementserver | where-object {$_.PrincipalName -eq “SCOM01.madeup.com”}

Set-SCOMParentManagementServer $Agents $_ -PrimaryServer $pri;

Set-SCOMParentManagementServer $Agents $_ -FailoverServer $sec

Peter Aston selected answer
    • 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.
    • Maybe this would be helpful if you want to loadbalance the clients. https://blog.tyang.org/2010/08/11/balancing-number-of-scom-agent-per-management-server-using-powershell/
    • 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.
    • Ok, then your script should work. You could implement part of the script I linked to to help with the loadbalancing of the agents.