Powershell script to enable SCOM Agent Proxy

Hi guys,

During an initial deployment of SCOM server many agents need to be configured as Proxy. SCOM server opens an Alert for each server it identifies should be configured as a Proxy. I have created a short script that read those alerts, extracts the server name of the agent that should be a Proxy, enables the proxy on that server and resolves the alert.

Lets look on the script (as you will see, nothing fancy!)


In the first part we import the OperationsManager module (if you run the script in the OpsMgr shell this step can be removed)

#Import Operations Manager module
Import-Module OperationsManager

Next step is to get all the alerts alerting on agent proxy, note the Criteria i’m using:

#Get all alerts on Agent Proxy Not Enabled
$alerts = @(Get-SCOMAlert -Criteria "MonitoringClassId='ab4c891f-3359-3fb6-0704-075fbfe36710' AND Name='Agent proxy not enabled' AND ResolutionState='0'")

Now we need to extract the server name from the alert. If you look on the alert using the SCOM Console you will see that the server name is somewhere in the a field called Parameters. To extract that I’m going to use a regular expression pattern – Special thanks to my colleague Elad who helped me here. In this step I’m going to configure the pattern, you will have to modify this according to your domain name:

#Configure pattern to search for server name within alert parameters
$Pattern = "\w+.yourdomain.suffix"


Now we need to read each and every alert, extract the agent name we need to enable and close the alert:

#For each alert
ForEach ($Alert in $Alerts)
#Get alert parameters
$AlertParameter = $alert | Select -Expand Parameters

#Extract server name from parameters
$Server = [regex]::Matches($AlertParameter,$Pattern)[0].Value

#Enable Agent proxy on server specified within alert
if ($server -ne $NULL){write-host "Enable SCOM Agent Proxy for Server " $Server; Get-SCOMAgent $Server | Enable-SCOMAgentProxy}

#Resolve alert
$alert | Set-SCOMAlert -ResolutionState 255 -Comment "Resolved By Enable-SCOMProxy.Ps1 Script"


I have learned a lot while writing this script, hope you will also learn a thing or two!

Download script – Don’t forget to change the extension to Ps1.


Incoming search terms:

  • agent proxy powershell scom
  • alert description: the agent was not able to submit data on behalf of another computer because agent proxy is not enabled details:health service
  • enable proxy scom 2007 powershell
  • Enable SCOm Agent Proxy powershell
  • powershell enable proxy agent for scom
  • scom script to enable agent proxy
  • скрипт в powershell через proxy


  1. Thank you, the alert disappeared from active alerts , but the Tick on the agent proxy not set. why?

    • Can you put here the alert description? Sometimes the command does not read the server’s name correctly and cannot enable proxy on it. In spite that, it will close the alert (due to the way the script is built).

What do you think about this post?