Finds a user in Active Directory.
Find-ADUser -DomainUrl <String> -sAMAccountName <String> [<CommonParameters>]
Searches the Active Directory domain given by DomainUrl for a user whose sAMAccountName matches the sAMAccountName passed in. Returns the DirectoryEntry object for that user. If there are any errors communicating with the domain controller, $null is returned.
| Name | Type | Description | Required? | Pipeline Input | Default Value |
|---|---|---|---|---|---|
| DomainUrl | String | The LDAP URL to the domain controller to contact. |
true | false | |
| sAMAccountName | String | Search by a user's sAMAcountName (i.e. Windows username). Special characters are escaped. |
true | false |
System.DirectoryServices.DirectoryEntry. The directory entry object of the user's account in Active Directory or $null if the user isn't found.
Find-ADUser -DomainUrl LDAP://dc.example.com:389 -sAMAccountName $env:USERNAME
Finds the AD user whose Windows username (sAMAccountName) is equal to thecurrently logged on user's username.