All PowerShell versions
You do not necessarily need additional cmdlets to search for user accounts or computers in your Active Directory. Provided you are logged on to the domain, simply use this:
$ldap = '(&(objectClass=computer)(samAccountName=dc*))' $searcher = [adsisearcher]$ldap $searcher.FindAll()
This would find all computer accounts that start with “dc”. $ldap can be any valid LDAP query. To find users, replace “computer” by “user”.