PowerShell Logo Small

Get-ADComputer



This is the built-in help made by Microsoft for the command 'Get-ADComputer', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets one or more Active Directory computers.

SYNTAX


Get-ADComputer [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Properties <String[]>] [-ResultPageSize <Int32>] [-ResultSetSize <Int32>] [-SearchBase
<String>] [-SearchScope {Base | OneLevel | Subtree}] [-Server <String>] -Filter <String> [<CommonParameters>]
Get-ADComputer [-Identity] <ADComputer> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Partition <String>] [-Properties <String[]>] [-Server <String>]
[<CommonParameters>]
Get-ADComputer [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Properties <String[]>] [-ResultPageSize <Int32>] [-ResultSetSize <Int32>] [-SearchBase
<String>] [-SearchScope {Base | OneLevel | Subtree}] [-Server <String>] -LDAPFilter <String> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-ADComputer cmdlet gets a computer or performs a search to retrieve multiple computers.


The Identity parameter specifies the Active Directory computer to retrieve. You can identify a computer by its distinguished name (DN), GUID, security identifier (SID) or
Security Accounts Manager (SAM) account name. You can also set the parameter to a computer object variable, such as $<localComputerObject> or pass a computer object through
the pipeline to the Identity parameter.


To search for and retrieve more than one computer, use the Filter or LDAPFilter parameters. The Filter parameter uses the PowerShell Expression Language to write query
strings for Active Directory. PowerShell Expression Language syntax provides rich type conversion support for value types received by the Filter parameter. For more
information about the Filter parameter syntax, type Get-Help about_ActiveDirectory_Filter. If you have existing LDAP query strings, you can use the LDAPFilter parameter.


This cmdlet retrieves a default set of computer object properties. To retrieve additional properties use the Properties parameter. For more information about the how to
determine the properties for computer objects, see the Properties parameter description.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291021
Add-ADComputerServiceAccount
Get-ADComputerServiceAccount
New-ADComputer
Remove-ADComputer
Remove-ADComputerServiceAccount
Set-ADComputer

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Get-ADComputer -Identity "Fabrikam-SRV1" -Properties *


AccountExpirationDate :
accountExpires : 9223372036854775807
AccountLockoutTime :
AccountNotDelegated : False
AllowReversiblePasswordEncryption : False
BadLogonCount :
CannotChangePassword : False
CanonicalName :
Fabrikam.com/Computers/fabrikam-srv1
Certificates : {}
CN : fabrikam-srv1
codePage : 0
countryCode : 0
Created : 3/16/2009 4:15:00 PM
createTimeStamp : 3/16/2009 4:15:00 PM
Deleted :
Description : DisplayName :
DistinguishedName : CN=fabrikam-srv1,CN=Computers,DC=Fabrikam, DC=com
DNSHostName : DoesNotRequirePreAuth : False
dSCorePropagationData : {3/16/2009 4:21:51 PM, 12/31/1600 4:00:01
PM}
Enabled : True
HomedirRequired : False
HomePage : instanceType : 0
IPv4Address :
IPv6Address : isCriticalSystemObject : False
isDeleted :
LastBadPasswordAttempt :
LastKnownParent :
LastLogonDate :
localPolicyFlags : 0
Location : NA/HQ/Building A
LockedOut : False
ManagedBy : CN=SQL Administrator 01,OU=UserAccounts,OU
=Managed,DC=Fabrikam,DC=com
MemberOf : {}
MNSLogonAccount : False
Modified : 3/16/2009 4:23:01 PM
modifyTimeStamp : 3/16/2009 4:23:01 PM
msDS-User-Account-Control-Computed : 0
Name : fabrikam-srv1
nTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySe
curity
ObjectCategory : CN=Computer,CN=Schema,CN=Configuration,DC=
Fabrikam,DC=com
ObjectClass : computer
ObjectGUID : 828306a3-8ccd-410e-9537-e6616662c0b0
objectSid : S-1-5-21-41432690-3719764436-1984117282-11
30
OperatingSystem :
OperatingSystemHotfix :
OperatingSystemServicePack :
OperatingSystemVersion :
PasswordExpired : False
PasswordLastSet :
PasswordNeverExpires : False
PasswordNotRequired : False
PrimaryGroup : CN=Domain Computers,CN=Users,DC=Fabrikam,D
C=com
primaryGroupID : 515
ProtectedFromAccidentalDeletion : False
pwdLastSet : 0
SamAccountName : fabrikam-srv1$
sAMAccountType : 805306369
sDRightsEffective : 0
ServiceAccount : {}
servicePrincipalName : {MSOLAPSVC.3/FABRIKAM-SRV1.FABRIKAM.COM:an
alyze, MSSQLSVC/FABRIKAM-SRV1.FABRIKAM.COM
:1456}
ServicePrincipalNames : {MSOLAPSVC.3/FABRIKAM-SRV1.FABRIKAM.COM:an
alyze, MSSQLSVC/FABRIKAM-SRV1.FABRIKAM.COM
:1456}
SID : S-1-5-21-41432690-3719764436-1984117282-11
30
SIDHistory : {}
TrustedForDelegation : False
TrustedToAuthForDelegation : False
UseDESKeyOnly : False
userAccountControl : 4096
userCertificate : {}
UserPrincipalName : uSNChanged : 36024
uSNCreated : 35966
whenChanged : 3/16/2009 4:23:01 PM
whenCreated : 3/16/2009 4:15:00 PM



This command gets a specific computer showing all the properties.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Get-ADComputer -Filter 'Name -like "Fabrikam*"' -Properties IPv4Address | FT Name,DNSHostName,IPv4Address -A
name dnshostname ipv4address
---- ----------- -----------
FABRIKAM-SRV1 FABRIKAM-SRV1.Fabrikam.com 10.194.99.181
FABRIKAM-SRV2 FABRIKAM-SRV2.Fabrikam.com 10.194.100.3



This command gets all the computers with a name starting by a particular string and showing the name, dns hostname and IPv4 address.




-------------------------- EXAMPLE 3 --------------------------

PS C:\>$d = [DateTime]::Today.AddDays(-90)
PS C:\> Get-ADComputer -Filter 'PasswordLastSet -ge $d' -Properties PasswordLastSet | FT Name,PasswordLastSet
Name PasswordLastSet
---- ---------------
FABRIKAM-SRV4 3/12/2009 6:40:37 PM
FABRIKAM-SRV5 3/12/2009 7:05:45 PM



This example gets all the computers that have changed their password in the last 90 days.




-------------------------- EXAMPLE 4 --------------------------

PS C:\>Get-ADComputer -LDAPFilter "(name=*laptop*)" -SearchBase "CN=Computers,DC=Fabrikam,DC=com"
name
----
saradavi-laptop
jeffpr-laptop



This command gets the computer accounts in the location CN=Computers,DC=Fabrikam,DC=com that are listed as laptops by using an LDAPFilter.




-------------------------- EXAMPLE 5 --------------------------

PS C:\>Get-ADComputer -Filter *



This command gets all computer accounts.