How to set Agent proxy enabled for all agents

Some customers have decided it is too much trouble to mess with setting Agent Proxy enabled on agents on an as-needed basis.  In some cases, they have too many agents being added on a daily basis, and the amount of work to keep up with this setting is cumbersome. 

We previously discussed some tools to enable these in bulk.  However, ongoing newly installed agents pose a bit of a challenge.


We already must enable agent proxy for the following roles, and more:

  • Domain Controller
  • Cluster Node
  • Exchange Server
  • SharePoint
  • SMS
  • Many 3rd party MP’s
  • Watcher Nodes
  • Any custom MP’s where the agent sends information about another entity.


Some customers just prefer to enable agent proxy on all agents, on a schedule, so they don’t have to worry with this, especially since it is already enabled on our most critical servers in the environments… domain controllers, exchange servers, and clusters.

Here is a powershell script which does just this.  It can be scheduled to run once per day, and take care of this setting for any agents that do not have agent proxying enabled.

## prepare OpsMgr shell 
if ((Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.EnterpriseManagement.OperationsManager.Client'}) -eq $null) 
   Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client -ErrorAction SilentlyContinue -ErrorVariable Err 
   if ($Err) { $(throw write-Host $Err) } 
if ((Get-ManagementGroupConnection | Where-Object {$_.ManagementServerName -eq $RMS}) -eq $null) 
   New-ManagementGroupConnection $RMS -ErrorAction SilentlyContinue -ErrorVariable Err 
   if ($Err) { $(throw write-Host $Err) } 
if ((Get-PSDrive | Where-Object {$_.Name -eq 'Monitoring'}) -eq $null) 
   New-PSDrive -Name: Monitoring -PSProvider: OperationsManagerMonitoring -Root: \ -ErrorAction SilentlyContinue -ErrorVariable Err 
   if ($Err) { $(throw write-Host $Err) } 
Set-Location Monitoring:\$RMS

## connect to management group 
$ManagementGroup = New-Object Microsoft.EnterpriseManagement.ManagementGroup($RMS) 

## set proxy enabled for all agents where it is disabled
$NoProxy = get-agent | where {$_.ProxyingEnabled -match "False"}
$NoProxy|foreach {$_.ProxyingEnabled=$true}
$NoProxy|foreach {$_.ApplyChanges()}


It takes a single parameter – the RMS name where you want to enable proxy for all agents.  It loads the OpsMgr snap-ins if they aren’t already loaded, and then runs the simple get-agent command at the end of the script.

A sample txt file is also attached.


Comments (10)

  1. Kevin Holman says:

    @Sam – both of these examples will enable agent proxy for ALL agents.

    If you would like to enable agent proxy based on class roles – please see:…/enable-agent-proxy-for-a-class-classproxyenabler.aspx

  2. John Erskine says:

    In OM12 you still load the snap-in to get to set-defaultsetting… From regular powershell run:

    add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client";

    new-managementGroupConnection -ConnectionString:ServerName.Domain.dom;

    set-location "OperationsManagerMonitoring::";

    Set-DefaultSetting -Name HealthServiceProxyingEnabled -Value True

  3. There is also a GLOBAL Setting for the whole management Group (like there was in MOM2005) but it is not exposed in the UI.

    Set-DefaultSetting -Name HealthServiceProxyingEnabled -Value True

    Once you do this, ALL agents should automatically inerit it and you won't have to do it again.

    I don't think it is supported, and I have not personally done TESTING with it, but it should work.

  4. Anonymous says:

    Thank you so much! Your blog has been such a lifesaver.

  5. Simon Skinner MS-MVP says:

    Both worked for me, Great thanks.

  6. sam says:

    Would this script or "Set-DefaultSetting" enable ONLY the DC's Exchange and Clusters?  Or both of these would enable all the agents to proxy enabled?

  7. Nathan Nesje says:

    I don't see the Set-DefaultSetting in the list of command in the SCOM2012 shell.  Is there another module that needs to be loaded for this to work?  Or was this command changed or removed in 2012?

  8. Ashley Poxon says:

    Thanks you John Erskine. Worked a treat

  9. IMS says:

    Should I replace RMS with My RMS server name -if yes which part please specify

  10. Anonymous says:

    Pingback from SCOM QUICK Install |