This post will examine the difference between PowerShell ADSI and ADSISearcher when using PowerShell to query Active Directory. ADSI and ADSISearcher are used to query Active Directory (AD) using Lightweight Directory Access Protocol (LDAP).
WHAT IS LDAP?
LDAP, as the name suggests, is a protocol that provides an interface to query AD directory services. When we are querying AD we are returning one or more objects with unique identifiers (a Distinguished Name). And we can do this using two type accelerators called ADSI and ADSISearcher.
WHAT IS A TYPE ACCELERATOR?
A type accelerator is a simple alias to represent a .Net class. We can return a list of type accelerators like so:
[System.Management.Automation.PSObject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get
You’ll notice that one of the type accelerators is psobject which references the class System.Management.Automation.PSObject. This means we could simplify our command above by using a type accelerator to get a list of all the type accelerators like so!
[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get









