Get-SCOMAgent
Gets the agent-managed computers in a management group.
Syntax
Get-SCOMAgent
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[<CommonParameters>]
Get-SCOMAgent
[-ManagementServer] <ManagementServer>
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[<CommonParameters>]
Get-SCOMAgent
[-DNSHostName] <String[]>
[-SCSession <Connection[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential>]
[<CommonParameters>]
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.
Examples
Example 1: Get all agents in the management group
PS C:\>Get-SCOMAgent -ComputerName "Server01.Contoso.Com"
This command establishes a temporary connection with the computer named Server01 and gets all agents in the management group.
Example 2: Get the agents managed by a management server
PS C:\>$MgmtServer = Get-SCOMManagementServer "MgmtServer01.Contoso.com"
PS C:\> Get-SCOMAgent -ManagementServer $MgmtServer
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.
Example 3: Get agents in a management group by using the agent name
PS C:\>Get-SCOMAgent -DNSHostName "server01.contoso.com", "Server02*", "*.Contoso.com"
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.
Example 4: Get all agents in a domain
PS C:\>Get-SCOMAgent -DNSHostName "*.Contoso.com" -ComputerName "Server01.Contoso.com"
This command establishes a temporary connection with the computer named Server01.Contoso.com and gets all agents in the Contoso.com domain.
Parameters
-ComputerName
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 (.).
The System Center Data Access service must be running on the computer. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.
Type: | String[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Credential
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 is the current user.
Type: | PSCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DNSHostName
Specifies the name of a Domain Name System (DNS) host of the agent-managed computer.
Type: | String[] |
Aliases: | Name |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-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.
Type: | ManagementServer |
Aliases: | MS |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-SCSession
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 is the current management group connection.
Type: | Connection[] |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Outputs
Microsoft.EnterpriseManagement.Administration.AgentManagedComputer