ADSearch

Get-ADUser without RSAT: query Active Directory from PowerShell

日本語

Get-ADUser without RSAT

ADSearch is a PowerShell module for machines where you can't install RSAT (Remote Server Administration Tools). It reads Active Directory, DNS, Group Policy links and Exchange configuration as an ordinary domain user.

Messages and warnings from the module are in Japanese. The English README explains the common ones.

Query Active Directory with ADSI in PowerShell

Without RSAT, the usual way to read AD from PowerShell is to write [adsisearcher] or System.DirectoryServices.DirectorySearcher code by hand. ADSearch wraps that in RSAT-style commands, using only .NET's System.DirectoryServices (ADSI/LDAP).

What it handles for you

Hand-written code has to build the LDAP filter, list the attributes to load, convert FileTime values and userAccountControl bits, and handle paging and large groups.

  • -Filter accepts PowerShell-style expressions (-like, -eq, parentheses, -and/-or) and turns them into LDAP filters. Raw LDAP filters pass through unchanged
  • Dates come back as dates, and LockedOut and PasswordExpired are read from the attributes the DC computes
  • Get-ADGroupMember -Recursive handles nested and circular groups, groups with more than 1,500 members, and members through primaryGroupID (such as Domain Users)
  • SID and ObjectGUID are returned as the same .NET types as RSAT

Download and load

  1. On GitHub, choose "Code → Download ZIP" and put the folder on your machine or a file share
  2. Load it in PowerShell
Import-Module C:\tools\ADSearch\ADSearch.psd1
File share, git clone and the execution policy

Or git clone https://github.com/YouheiOonuki/ADSearch. From a file share:

Import-Module \\fileserver\tools\ADSearch\ADSearch.psd1 -Force

If the execution policy (RemoteSigned etc.) blocks it, use the bundled Import-ADSearch.ps1.

. ([scriptblock]::Create((Get-Content 'C:\tools\ADSearch\Import-ADSearch.ps1' -Raw)))
Import-ADSearch -Path 'C:\tools\ADSearch'

For downloaded files, unblocking them first with Get-ChildItem -Recurse | Unblock-File lets them load normally.

Examples and commands (42)

# Get a user
Get-ADUser -Identity jsmith -Server dc01.corp.local

# Group members, recursively
Get-ADGroupMember -Identity "IT-Staff" -Recursive -Server dc01.corp.local

Domain and user names in the examples are fictitious.

More examples
# Filter
Get-ADUser -Filter "DisplayName -like 'Smith*'" -Server dc01.corp.local

# Enabled accounts that are locked out
Get-ADUser -Filter "Enabled -eq '$true'" -Server dc01 | Where-Object LockedOut

# DNS records (with IP addresses)
Get-ADDnsRecord -Name pc001 -ComputerName dc01.corp.local

# Self-test: loaded correctly, and the DC is reachable
Invoke-ADSearchSelfTest -Server dc01.corp.local
All 42 commands

Directory

Get-ADUserGet-ADGroupGet-ADGroupMemberGet-ADComputerGet-ADOrganizationalUnitGet-ADObjectGet-ADServiceAccountGet-ADDomainGet-ADDomainControllerGet-ADForestGet-ADDefaultDomainPasswordPolicyGet-ADTrust

Sites, replication, GPO and DNS

Get-ADReplicationSiteGet-ADReplicationSiteLinkGet-ADReplicationSubnetGet-ADReplicationConnectionGet-ADGpoLinkGet-ADDnsRecord

Exchange configuration

Get-ExchangeServerGet-ReceiveConnectorGet-SendConnectorGet-AcceptedDomainGet-RemoteDomainGet-TransportRuleGet-MailboxDatabaseGet-DatabaseAvailabilityGroupGet-AddressListGet-GlobalAddressListGet-OfflineAddressBookGet-EmailAddressPolicy

Exchange recipients

Get-RecipientGet-MailboxGet-RemoteMailboxGet-MailUserGet-MailContactGet-DistributionGroupGet-DynamicDistributionGroupGet-DistributionGroupMember

Diagnostics and inventory

Invoke-ADSearchSelfTestGet-ADUserHealthSearch-ADAccountGet-ADComputerHealth

The Exchange commands read what Exchange stores in AD; they don't connect to an Exchange server. Parameters and output are in the reference manual (Japanese).

FAQ

Does it ever change anything in AD?
No. Every exported command only gets, searches or runs a self-test. The scripts in the forTest folder that create test data are for test environments only; do not run them in production.
Does it give the same results as RSAT's Get-ADUser?
The main parameters and output properties follow RSAT. The differences are listed under RSAT-compatible properties and Deliberate omissions in the README.
The execution policy stops it from loading.
Use the bundled Import-ADSearch.ps1. It reads the files as text and loads them as script blocks, so the file execution policy does not apply.

Notes

Feedback and bug reports (Google Forms): the form is in Japanese, but you can write in English. GitHub Issues are also welcome.

The site-wide about page and disclaimer and privacy policy apply to all tools.

Changes
  • Version 1.4.1: fixed '$true' in -Filter, Get-ADComputer PC001 (without $), and -Identity by name for trusts, sites and Exchange configuration. Added a test that runs without AD
  • Released (version 1.4.0)

Test a proxy PAC file against a list of URLs → PAC File Tester