Problem
You want to manage Operations Manager agents on remote machines.
Solution
To retrieve information about installed agents, use the GetAgent cmdlet:
PS Monitoring:\Oxford.contoso.com >GetAgent | SelectObject DisplayName
DisplayName
Ibiza.contoso.com Denver.contoso.com Sydney.contoso.com
To remove an agent, use the UninstallAgent cmdlet:
PS Monitoring:\Oxford.contoso.com >GetAgent | WhereObject { $_.DisplayName match "Denver" } | >> UninstallAgent
To install an agent on a specific computer, use the InstallAgentByName function:
PS Monitoring:\Oxford.contoso.com >InstallAgentByName Oxford.contoso.com
Discussion
The GetAgent cmdlet returns a great deal of information about each agent it retrieves. The example in the solution filters this to show only the DisplayName, but you may omit the SelectObject cmdlet to retrieve all information about that agent.
If you need more control over the agent installation process, examine the content of the InstallAgentByName function:
PS Monitoring:\Oxford.contoso.com
>GetContent Function:\InstallAgentByName
The function simplifies the most common scenario for installing agents, but the InstallAgent cmdlet that supports it provides additional functionality.
For more information about the GetAgent cmdlet, type GetHelp GetAgent. For more information about the InstallAgent cmdlet, type InstallAgent. For more information about the UninstallAgent cmdlet, type GetHelp UninstallAgent.