When querying Active Directory (AD) we can use a PowerShell type accelerator called the ADSI Searcher and the ActiveDirectory PowerShell Module.
Most Google searches provide examples that use the PowerShell ActiveDirectory module cmdlets such as Get-ADUser and Get-ADComputer. Whilst these work well, they require that Remote Server Administration Tools (RSAT) is installed locally. And sometimes this prerequisite is a pain in the backside if we’re working on a machine without it.
An alternative is to use PowerShell type accelerators called ADSI and the ADSI searcher. These type accelerators respectfully represent the classes System.DirectoryServices.DirectoryEntry and System.DirectoryServices.DirectorySearcher, and form part of the .Net framework.
We’ve created a series of tutorials starting with the difference between ADSI and ADSISearcher and expanding further to provide examples of filtering AD searches, manipulating users, groups, computers, attributes and much more.