Get the service accounts that are hosted by an AD computer.
Syntax Get-ADComputerServiceAccount [-Identity] ADComputer [-AuthType {Negotiate | Basic}] [-Credential PSCredential] [-Partition string] [-Server string] [CommonParameters] Key -AuthType ADAuthType The authentication method to use: Negotiate or 0 Basic or 1 A Secure Sockets Layer (SSL) connection is required for the Basic authentication method. -Credential PSCredential A user account that has permission to perform this action. The default is the current user unless the cmdlet is run from an AD PowerShell provider drive in which case the account associated with the drive is the default. "User64" or "Domain01\User64" or a PSCredential object. -Identity ADComputer An AD computer object: Distinguished Name Example: CN=PC1234,CN=Europe,CN=Users,DC=SS64,DC=com GUID (objectGUID) Example: 579c4d2e-f62d-4d20-8a88-030d97495f10 Security Identifier (objectSid) Example: S-1-5-21-3164297828-301567370-526410523-1153 Security Accounts Manager Account Name (sAMAccountName) Example: PC1234 The identifier in parentheses is the LDAP display name for the attribute. The cmdlet searches the default naming context or partition to find the object. If the identifier given is a DN, the partition to search will be computed from that DN. If two or more objects are found, the cmdlet returns a non-terminating error. This parameter can also accept an object through the pipeline. -Partition string The distinguished name of an AD partition. The distinguished name must be one of the naming contexts on the current directory server. The cmdlet searches this partition to find the object defined by the -Identity parameter. examples: -Partition "CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM" -Partition "CN=Schema,CN=Configuration,DC=EUROPE,DC=TEST,DC=SS64,DC=COM" In many cases, a default value will be used for -Partition if no value is specified. -Server DomainName\ComputerName The domain controller that will add the computer to the domain. Default = the local computer. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.
Get-ADComputerServiceAccount gets all of the service accounts that are hosted by the specified computer.
The -Computer parameter specifies the AD computer that hosts the service accounts. Identify a
computer by its distinguished name (DN), GUID, security identifier (SID) or Security Accounts Manager (SAM) account
name. You can also set the -Computer parameter to a computer object variable, or pass a computer object through the pipeline to the -Computer parameter, for example, using Get-ADComputer.
Examples
Get the service accounts hosted on a computer account 'pc64':
PS C:\> Get-ADComputerServiceAccount -Identity pc64
“The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents” ~ Nathaniel Borenstein
Related PowerShell Cmdlets:
Add-ADComputerServiceAccount - Add one or more service accounts to an AD computer.
Remove-ADComputerServiceAccount - Remove one or more service accounts from a computer.