Get-sqmADAccountStatus
Security
sqmSQLTool v1.8.2+ · Active Directory
🛠 Pipeline-capable
Enabled, LockedOut, PasswordExpired, and AccountExpired.
The function automatically uses the RSAT ActiveDirectory module if available (via
Get-ADUser), or falls back to ADSI if RSAT is not installed. Useful for validating AD account health before SQL Server logins or permissions changes.
Parameters
| Parameter | Type | Required | Default | Notes |
|---|---|---|---|---|
| -SamAccountName | string[] | Required | — | One or more sAMAccountName values. Pipeline-capable. |
| -DomainController | string | Optional | — | Target DC (RSAT path only). Ignored by ADSI fallback. |
Execution Flow
Examples
Check a single AD user account
Get-sqmADAccountStatus -SamAccountName 'jdoe'
Pipeline: check multiple accounts
'jdoe','jsmith','awalker' | Get-sqmADAccountStatus
Check with specific domain controller (RSAT only)
Get-sqmADAccountStatus -SamAccountName 'jdoe' -DomainController 'DC01'