Powershell: Updating Proxy Agent for Multiple SNMP-enabled Devices (part 1)

As explained in part 3 of the SNMP in OpsMgr / Essentials series (still in progress), we explained that SNMP-enabled devices can be monitored from any management server OR agent-managed computer. The question we answer today is:

“How do I change the proxy agent for some or all of my network enabled devices?”

If I want to use an agent-managed computer as the proxy for multiple network devices, the script below will allow you to submit a wildcard filter based on device IP address to update the proxy agent for all SNMP-enabled devices matching the filter. Check back for the next installment in which we demonstrate how to specify a management server as the proxy agent for multiple devices.

INSTRUCTIONS FOR USE

Cut-and-paste the script below into Notepad, and save as updateproxyagent.ps1. Script should run from any computer with OpsMgr Console and Powershell installed.

SYNTAX

The script accepts the following 3 required parameters. Run with no parameters to view syntax help.

-rootMS: FQDN of the root management server for the target management group.

Ex: ‘RootManagementServer.fqdn.local’

-proxyAgent: Agent that will serve as the proxy agent

Ex: ‘dc.contoso.com’

-deviceName: IP address or IP wildcard range.

Ex: ‘192.168.1*’

SAMPLE SCRIPT

Here is the sample script. You should be able to cut-and-paste this one with no worries about line wrap.

#———–Begin Sample Script————–

#———–End Sample Script————–

Conclusion

Hopefully some of you will find this one useful. Check back soon when we’ll look at how to assign a management server as a proxy agent for multiple SNMP-enabled devices using Powershell. Please submit feedback as a comment on this post.

0 thoughts on “Powershell: Updating Proxy Agent for Multiple SNMP-enabled Devices (part 1)

  1. Kris Bash

    This is fantastic, by the way. Thanks for providing the workaround to assigning remote devices to management server proxy agents.

  2. Marnix Wolf

    Great stuff Pete! You’re one of the SCOM Kings to me! Thanks for sharing since this saved me hours of boring and prone to error, work!
    Cheers,
    Marnix

Leave a Reply

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