There are modules and cmdlets to deal with Active Directory tasks, but sometimes it is easier and faster to simply use some .NET code instead.
If you just want to know, for example, where a given user exists in your Active Directory, then searching for an account is a snap:
# sending LDAP query to Active Directory $searcher = [ADSISearcher]'(&(objectClass=User)(objectCategory=person)(sAMAccountName=tobias*))' # finding first match $searcher.FindOne() # finding ALL matches $searcher.FindAll()
This would find all user accounts with a SamAccountName that starts with "tobias". You can now use this approach to easily find out where an account is located:
# find account location $searcher.FindAll() | Select-Object -ExpandProperty Path