OpsMgr 2012: Update agent failover settings from a spreadsheet via PowerShell [sample script]

By request, here is a quick script with the bare necessities to implement a bulk update of an agents primary and failover management server settings in System Center 2012 – Operations Manager (OpsMgr). This script performs the following functions:

1) Using PowerShell, retrieves a list of agents and their management server settings from this spreadsheet.

This allows someone to adjust the agent settings on demand, add new servers, etc.


2) In the script, parse the list of agents and their primary and failover management server settings

3) Updates those settings via the OpsMgr Command Shell.

Sample Script

This is the quickest, most simple implementation you can imagine, which is intended to be run in an OpsMgr Command Shell. With the comments below, it should be pretty easy to see what is happening in each step, and perhaps provides a bit of insight into how easily you can retrieve and parse comma-separated data in PowerShell. I will provide something a bit more elaborate in a follow-on post, but wanted to get the sample published quickly.

Additional Resources

You’ll find a growing number of System Center, Cloud and PowerShell resources here on SCC in the “Master Collection of System Center PowerShell” and elsewhere. A few related Operations Manager 2012 Command Shell articles

OpsMgr 2012:See Who is Currently Connected to Your Management Group via PowerShell

Cloning Notification Subscriptions in Operations Manager 2012 using PowerShell [sample script]

OpsMgr 2012: All my Java apps require manual discovery – where do I get BeanSpy and PowerShell install scripts?

OpsMgr 2012: Reset Unit Monitors in Bulk with PowerShell

OpsMgr 2012: Find Computers without the Active Directory Helper Object (OOMADS) with PowerShell

OpsMgr 2012: Disabling Rules and Monitors in Bulk in PowerShell

OpsMgr 2012: Group Maintenance Mode via PowerShell (the way it should be)

OpsMgr 2012: Running a Task in Bulk Using PowerShell

OpsMgr 2012: Automating Agent Discovery and Deployment with PowerShell [sample script]

OpsMgr 2012: Identifying Computers in Active Directory without an OpsMgr Agent Installed [sample script]

OpsMgr 2012 Quick Tip: Finding servers experiencing the most heartbeat failures with PowerShell

2 thoughts on “OpsMgr 2012: Update agent failover settings from a spreadsheet via PowerShell [sample script]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.