Get-Agent
Get-Agent
Gets the agents associated with the specified management server.
Syntax
Parameter Set: FromMonitoringObjectProviderPath
Get-Agent [[-Path] <String[]> ] [ <CommonParameters>]
Parameter Set: FromManagementServer
Get-Agent [-ManagementServer] <ManagementServer> [ <CommonParameters>]
Detailed Description
Gets the agents associated with the specified management server.
Parameters
-ManagementServer<ManagementServer>
Specifies the management server. Only agents associated with the specified management server will be retrieved. You can use Get-ManagementServer to retrieve an object that can be used as the value of this parameter.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Path<String[]>
Specifies paths to management groups if the management server is not explicitly specified by using the ManagementServer parameter. All agent management computers for the referenced management groups will be returned. To specify multiple paths, separate them by using commas.
Aliases |
none |
Required? |
false |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters
Notes
- For more information, type "Get-Help Get-Agent -detailed". For technical information, type "Get-Help Get-Agent -full".
When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".
Examples
-------------- EXAMPLE 1 --------------
This command gets all the agents associated with the currently connected management server.
C:\PS>get-agent -ManagementServer (get-managementserver)
-------------- EXAMPLE 2 --------------
This command first uses Get-ManagementServer to retrieve an object representing the management server named 'fabrikam' and stores a reference to the object in the $mgmt_svr variable. It then uses Get-Agent to retrieve only those agents associated with the 'fabrikam' management server.
C:\PS>$mgmt_svr = get-managementserver -path "monitoring:\fabrikam"
get-agent -managementserver $mgmt_svr