Let’s get started.
Users That Can Log On To All Computers
You can search accounts that have log on restrictions set on the Account tab. In this example, I’ll list all accounts that can log on to all computers.
Get-ADUser -LDAPFilter "(!LogonWorkstations=*)" -Properties * | select-object samaccountname,givenname,surname,logonworkstationsExample 9. Find Users by Last Name
Get-ADUser -Filter "Surname -eq 'smith'"Get All Users in the Domain
get-aduser -filter *Example 7. Get All Users from an OU
You first need to get the distinguishedName of the OU.
To do this, right click on the OU, and select properties. Then select the Attribute Editor Tab and find the distinguishedName value.

get-aduser -filter * -SearchBase "OU=Accounting,OU=ADPRO Users,DC=ad,DC=activedirectorypro,DC=com"Get All Users & The Department Attribute
get-aduser -filter * -Properties * | select displayname, departmentGet All Phone Numbers for a User
Get-ADUser -Identity Alice.Mills -Properties * | select name, *phone*Get a Single User
get-aduser -Identity robert.allenExample screenshot below.
Get All Users with a Logon Script
Get-ADUser -Filter {Scriptpath -ne "$Null"} -Properties * | select name, scriptpathGet All Users and Format the Output
To make the previous example easier to read you can output the results in columns using the format-table option.
get-aduser -filter * | Format-TableYou can see below this format is much easier to read.
Example 13. Search Users by City
get-aduser -filter {City -like "Indianapolis"} -Properties * | select name, cityTopics: Search Active Directory
Get All Users Email Addresses
get-aduser -filter * -Properties * | select givenname, sn, mailFind Users by First Name
Get-ADUser -Filter "GivenName -eq 'mark'"Video Tutorial
If you don’t like videos or need more instructions, then continue reading.
Get a Single User and All User Properties
get-aduser -Identity robert.allen -Properties *



