Solved

Check if user AD account is disabled

Posted on 2016-09-28
3
28 Views
Last Modified: 2016-09-28
How can I check if a users AD account is disabled?
0
Comment
Question by:Roccat
3 Comments
 
LVL 12

Assisted Solution

by:Dustin Saunders
Dustin Saunders earned 250 total points
ID: 41820508
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

0
 
LVL 40

Accepted Solution

by:
Subsun earned 250 total points
ID: 41820521
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.
0
 

Author Closing Comment

by:Roccat
ID: 41820539
Thanks again!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
A brief introduction to what I consider to be the best editor for PowerShell.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question