Enable Agent “Act as a Proxy” in bulk via Powershell
There was a post in the OpsMgr newsgroup asking how one could go about changing the ‘Act as a Proxy’ setting on more than one server. This is an issue because the new OpsMgr architecture now requires Domain Controllers associated with the Active Directory Management Pack need to have the “Act as a Proxy” setting enabled for certain features. Well, if you are in a large environment and have 20 domain controllers, it would be really time consuming to enable each agent individually.
Thanks to Ian Blythe, we have posted a Powershell script in the downloads section of this site that will update the “Act as a Proxy” setting on a group of agents. The Powershell Script is called Set-AgentProxyBulk.ps1 (uploaded as zip) and it takes two command line arguments.
rootRMS: The FQDN of Root Management Server so that the script can connect to the Management Group.
groupPathName: Path name to the group of servers you want to enable the “Act as a Proxy” setting.
Ex: Microsoft.Windows.Server.2003.AD.DomainControllerComputerGroup.
To execute this Powershell script, run the following command. (This command assumes you download the script into the root of C: on your Management Server. If you save the Powershell script somewhere else, you will need to update the path to the file in the command line.)
powershell c:\Set-AgentProxyBulk.ps1 -rootMS: nocrms01.noc.momresources.org -groupPathName: Microsoft.Windows.Server.2003.AD.DomainControllerComputerGroup
If all goes well, the script will write some output to the console stating that it successfully enabled the proxy setting for the agent. I ran this script several times in my test environment to be sure that it worked.
You can download the script from our downloads section or from here SetAgentProxyBulk.zip
July 15th, 2008 at 9:35 pm
This worked perfect for the AD group. Now I am trying to run it against a group I made containing specific SQL servers. I have queried the OPS DB in BaseManagedEntity and found the groups FullName, which is “UINameSpace322e45650ff8407bba416d809896597b.Group”
When I use this for the GroupPathName in the script i get the following error:
You cannot call a method on a null-valued expression.
At C:\Set-AgentProxyBulk.ps1:23 char:63
+ $relatedMonitoringObjects = $group.GetRelatedMonitoringObjects( <<<< )
Any suggestions on what I am doing wrong?