Set Primary and Failover Mgmt Server Powershell Script for OpsMgr 2007

This sample script illustrates how to retrieve a list of agents based on a common search element, and then loop through these agents, updating the settings on each. Update setting as instructed in comments, then save with a .ps1 file. The script can be run on any computer with the Operations Console / Command Shell interfaces loaded.

Originally published in this blog post…just moving this to an easy-to-find download. Click download button at right for a downloadable copy.

P.S. – Do handle with care. Make sure your agents can reach the Mgmt Servers you specify in the script to avoid “orphaned” agents.