Both ways require the use of the Operations Manager Shell. To configure the agents, open Operations Manager Shell.
Start > All Programs > Microsoft System Center 2012 > Operations Manager Shell
Configuring Servers One at a Time:
If you only need to configure one, or a small number of servers you can run the following command for each and it shouldn't take too much time.
$primaryMS = Get-SCOMManagementServer –Name “<name of primary server>” $failoverMS = Get-SCOMManagementServer –Name “<name of 1st failover>”,”<name of 2nd failover>”,”<name of nth failover>” $agent = Get-SCOMAgent –Name “<name of agent>” Set-SCOMParentManagementServer –Agent $agent –PrimaryServer $primaryMS Set-SCOMParentManagementServer –Agent $agent –FailoverServer $failoverMSYou will return to a command prompt if successful.
Configuring Servers in a Group:
If you have just setup your gateway servers and deployed a lot of agents using the one at a time method is tedious and time consuming. The following script will pull the agents and gateway servers from a spreadsheet and process all of them automatically. Enter the agents and gateway servers as shown below and save the file as c:\servers.txt
Now that we have our server list lets go ahead and bring Operations Manager Shell back up and run the following command.
#Pass in comma-separated list $List = Import-Csv C:\servers.txt #Loop through each line of the csv file ForEach ($entry in $list){ $AgentName = $($entry.Agent) $PrimaryMSName = $($entry.PrimaryMS) $FailoverMSName = $($entry.FailoverMS) #Set Primary Management Server on Agent Set-SCOMParentManagementServer -Agent (Get-SCOMAgent -DNSHostName "$AgentName") ` -PrimaryServer (Get-SCOMManagementServer -Name "$PrimaryMSName") -PassThru #Set Fail-over Management Server on Agent Set-SCOMParentManagementServer -Agent (Get-SCOMAgent -DNSHostName "$AgentName") ` -FailoverServer (Get-SCOMManagementServer -Name "$FailoverMSName") -PassThru }It should be fairly easy to see what is happening at each step and is the fastest and simplest way to implement failover to agents.
More to come!
Contributing documentation:
Microsoft Technet
Peter Zerger
where we have to set the Primary and failover management server names in the above script?
ReplyDeleteYou would set those in the .txt file. The script will query this for the server information.
Delete