Disable-ADAccount
Use Disable-ADAccount to disable an Active Directory user or computer account, blocking sign-in while keeping the object.
Documentation: Microsoft Learn — Disable-ADAccount
Syntax
See the command anatomy
Inspect this authored example with fictional data in the bounded browser model. The numbered stages show how its objects change.
Get-ADUser -Identity jsmith -Properties Enabled | Select-Object Name, Enabled- Stage 1Get-ADUser
-Identity -Properties - Stage 2Select-Object
Positional values or no named parameters
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Follow the objects
Run the command to inspect each stage.
Examples
Disable-ADAccount -Identity jsmith
Show reference output
Sample output · fictional data, shaped like the real thing
DistinguishedName : CN=John Smith,OU=Users,DC=corp,DC=local Enabled : False GivenName : John Name : John Smith ObjectClass : user SamAccountName : jsmith UserPrincipalName : jsmith@corp.local
Get-ADUser -Filter 'Department -eq "Contractors"'
Show reference output
Sample output · fictional data, shaped like the real thing
Name ---------- Jane Smith Alex Jones
Get-ADUser -Identity jsmith
Show reference output
Sample output · fictional data, shaped like the real thing
Name Enabled ---------- ------- Jane Smith True Alex Jones True
Parameters
Parameter definitions:
-Identity-Server-Credential-PassThru-WhatIf
Practical use and troubleshooting
Practical scenario: Use Disable-ADAccount when you need to disable an Active Directory user or computer account, blocking sign-in while keeping the object. Start with one identified target and inspect the returned values before extending the operation to a list. Keep the identity in your report so you can trace each result back to the object or path that produced it.
Common error and fix: Access denied indicates missing rights on the directory object. Resolve the exact account, inspect delegation and verify the enabled flag after an authorised change. In an unattended script, capture this failure with its original error record and record which target failed. An empty result and an unsuccessful query must remain distinguishable in the final report.
See also: Enable-ADAccount. Enable-ADAccount changes the enabled flag to allow account use; Disable-ADAccount disables the account. Neither operation is the same as unlocking a temporarily locked account. Read the linked command before substituting it; similar names do not imply identical inputs or output.
Recap
Disable-ADAccount Use Disable-ADAccount to disable an Active Directory user or computer account, blocking sign-in while keeping the object.
Next: Enable-ADAccount