Check if user AD account is disabled

How can I check if a users AD account is disabled?
Who is Participating?
SubsunConnect With a Mentor Commented:
You don't have to use the Filter, directly run the Get-ADUser against user name (a bit faster than using Filter)
Import-Module ActiveDirectory
Get-ADUser UserName | Select Name,Enabled

Open in new window

If Enabled shows True then account is enabled, if it shows False then account is disabled.
Dustin SaundersConnect With a Mentor Director of OperationsCommented:
Get-ADUser -Filter {samaccountName -eq "dsaunders"}

Open in new window

Will show you the results of the account with the matching sAMAccountName.

You can also use the .Enabled property.
$user = Get-ADUser -Filter {samaccountName -eq "dsaunders"}
Write-Host $user.Enabled

Open in new window

RoccatAuthor Commented:
Thanks again!
All Courses

From novice to tech pro — start learning today.