PowerShell Logo Small

Get-ADUser



This is the built-in help made by Microsoft for the command 'Get-ADUser', 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 users.

SYNTAX


Get-ADUser [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Properties <String[]>] [-ResultPageSize <Int32>] [-ResultSetSize <Int32>] [-SearchBase <String>]
[-SearchScope {Base | OneLevel | Subtree}] [-Server <String>] -Filter <String> [<CommonParameters>]
Get-ADUser [-Identity] <ADUser> [-AuthType {Negotiate | Basic}] [-Credential <PSCredential>] [-Partition <String>] [-Properties <String[]>] [-Server <String>]
[<CommonParameters>]
Get-ADUser [-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-ADUser cmdlet gets a user object or performs a search to retrieve multiple user objects.


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


To search for and retrieve more than one user, 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 user object properties. To retrieve additional properties use the Properties parameter. For more information about the how to
determine the properties for user objects, see the Properties parameter description.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291054
New-ADUser
Remove-ADUser
Set-ADUser

REMARKS

<

Examples


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

PS C:\>Get-ADUser -Filter * -SearchBase "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM"



This command gets all users under the container OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM.




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

PS C:\>Get-ADUser -Filter 'Name -like "*SvcAccount"' | FT Name,SamAccountName -A
Name SamAccountName
---- --------------
SQL01 SvcAccount SQL01
SQL02 SvcAccount SQL02
IIS01 SvcAccount IIS01



This command gets all users that have a name that ends with SvcAccount.




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

PS C:\>Get-ADUser -Identity GlenJohn -Properties *
Surname : John
Name : Glen John
UserPrincipalName :
GivenName : Glen
Enabled : False
SamAccountName : GlenJohn
ObjectClass : user
SID : S-1-5-21-2889043008-4136710315-2444824263-3544
ObjectGUID : e1418d64-096c-4cb0-b903-ebb66562d99d
DistinguishedName : CN=Glen John,OU=NorthAmerica,OU=Sales,OU=UserAccounts,DC=FABRIKAM,DC=COM



This command gets all properties of the user with samAccountName GlenJohn.




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

PS C:\>Get-ADUser -Filter {Name -eq "GlenJohn"} -SearchBase "DC=AppNC" -Properties mail -Server lds.Fabrikam.com:50000



This command gets the user with name GlenJohn on the AD LDS instance.