Monday, October 5, 2009

Bulk Enable Agent Proxy by Agent Name

There are a few scripts out there to enable agent proxy but I couldn’t find one that met my requirements, so I came up with this:
# Begin script
get-agent | ? { $_.Name -Like '*dc*' } | foreach {
$_.name;
$_.ProxyingEnabled = $True;
$_.ApplyChanges();
$_.ProxyingEnabled
}
# End script

To use this, simply paste it into an Operations Manager PowerShell session.
It will enable agent proxy for all agents that have a name like “*dc*”.  Before running this, it’s best to run the following one-liner to make sure you will change the correct agents:
get-agent | ? { $_.Name -Like '*dc*' } | ft Name
This should speed things up when you need to enable agent proxy for lots of agents.  Exchange servers and AD domain controllers immediately spring to mind..