Get-SCOMAgent
Get-SCOMAgent
Gets the agent-managed computers in a management group.
Syntax
Parameter Set: Empty
Get-SCOMAgent [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromAgentNames
Get-SCOMAgent [-DNSHostName] <String[]> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Parameter Set: FromManagementServer
Get-SCOMAgent [-ManagementServer] <ManagementServer> [-ComputerName <String[]> ] [-Credential <PSCredential> ] [-SCSession <Connection[]> ] [ <CommonParameters>]
Detailed Description
The Get-SCOMAgent cmdlet gets the agent-managed computers in a management group. You can specify the DNSHostName parameter to get the agent-managed computers on a Domain Name System (DNS) host, or you can specify the ManagementServer parameter to get all the child agent-managed computers for a primary management server.
Parameters
-ComputerName<String[]>
Specifies an array of names of computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).
You must run the System Center Data Access service on the target computer before you use this cmdlet. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
localhost |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-Credential<PSCredential>
Specifies a PSCredential object for the management group connection. To obtain a PSCredential object, use the Get-Credential cmdlet. For more information, type Get-Help Get-Credential
.
If you specify a computer in the ComputerName parameter, use an account that has access to that computer. The default value is the current user.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue) |
Accept Wildcard Characters? |
false |
-DNSHostName<String[]>
Specifies the name of a Domain Name System (DNS) host of the agent-managed computer.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-ManagementServer<ManagementServer>
Specifies a ManagementServer object. This parameter specifies the primary management server from which to retrieve all child agents. To obtain a ManagementServer object, use the Get-SCOMManagementServer cmdlet.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
false |
-SCSession<Connection[]>
Specifies an array of Connection objects. To obtain a Connection object, use the Get-SCOMManagementGroupConnection cmdlet.
A connection object represents a connection to a management server. The default value is the current management group connection.
Aliases |
none |
Required? |
false |
Position? |
named |
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 (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- Microsoft.EnterpriseManagement.Administration.AgentManagedComputer
Examples
Example 1: Get all agents in the management group
This command establishes a temporary connection with the computer named Server01 and gets all agents in the management group.
PS C:\> Get-SCOMAgent -ComputerName "Server01.Contoso.Com"
Example 2: Get the agents managed by a management server
This example gets agent-managed computers that are managed by a management server.
The first command gets the management server object named MgmtServer01.Contoso.com and stores the object in the $MgmtServer variable.
The second command gets the agents that are managed by the management server stored in $MgmtServer.
PS C:\> $MgmtServer = Get-SCOMManagementServer "MgmtServer01.Contoso.com"
PS C:\> Get-SCOMAgent -ManagementServer $MgmtServer
Example 3: Get agents in a management group by using the agent name
This command gets agents that are named server01.contoso.com, that have a name that begins with Server02, and that are in the Contoso.com domain.
PS C:\> Get-SCOMAgent -DNSHostName "Server01.Contoso.com", "Server02*", "*.Contoso.com"
Example 4: Get all agents in a domain
This command establishes a temporary connection with the computer named Server01.Contoso.com and gets all agents in the Contoso.com domain.
PS C:\> Get-SCOMAgent -DNSHostName "*.Contoso.com" -ComputerName "Server01.Contoso.com"