As a quick background on the requirement to enable proxy in OpsMgr – this is required for a significant number of management packs including SQL, SharePoint, Exchange, Clusters, IIS and more. The following are a few quick PowerShell examples to display and enable the proxy setting for various servers in OpsMgr:

 

Find servers with SQL in the name which do not have proxy enabled: (this is useful when attempting to identify all servers of a type based on a naming convention such as SQL or DB for database or Exch for Exchange, etc)

Get-SCOMAgent -DNSHostName *sql* | where{$_.ProxyingEnabled -notlike "*True*"}

 

Or  more properly (based on feedback to this blog post):

Get-SCOMAgent -DNSHostName *sql* | where{$_.ProxyingEnabled.Value -eq $false}

 

Find servers with SQL in the name where proxy is not enabled and enable proxy on them: (this is like the previous example but actually enables proxy on those servers matching the naming which do not currently have it enabled)

Get-SCOMAgent -DNSHostName *sql* | where{$_.ProxyingEnabled -notlike "*True*"} | Enable-SCOMAgentProxy

 

Or  more properly (based on feedback to this blog post):

Get-SCOMAgent -DNSHostName *sql* | where{$_.ProxyingEnabled.Value -eq $false}| Enable-SCOMAgentProxy

 

Display the proxy setting for a file which contains a list of servers: (the file just contains the list of servers to check proxy on, this is useful when you have a large number of servers to check the proxy setting for)

$a = Get-Content c:\scripts\input\servers.txt

$a | foreach{

Get-SCOMAgent –DNSHostName $_

}

 

Enable the proxy setting for a list of servers in a file: (this is useful to enable proxy on a large number of servers and you have a list of what servers you want to enable these on)

$a = Get-Content c:\scripts\input\servers.txt

$a | foreach{

Get-SCOMAgent –DNSHostName $_ | Enable-SCOMAgentProxy

}

 

Thanks to Ambers Ferrara for his continued approaches to showing me how PowerShell can make an Operations Manager administrator’s day much easier!