Examples: To find all users in a given organizational unit (OU) whose name starts with "jon" and whose account has been disabled ...

Examples:
To find all users in a given organizational unit (OU) 
whose name starts with "jon" and whose account has been disabled 
for logon and display their user principal names (UPNs):

    dsquery user ou=Test,dc=microsoft,dc=com -o upn -name jon* -disabled

To find all users in only the current domain, whose names end with "smith"
and who have been inactive for 3 weeks or more, and display their DNs:

    dsquery user domainroot -name *smith -inactive 3

To find all users in the OU given by ou=sales,dc=microsoft,dc=com and display
their UPNs:

    dsquery user ou=sales,dc=microsoft,dc=com -o upn