Solved

Check if user AD account is disabled

Posted on 2016-09-28
3
29 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
A procedure for exporting installed hotfix details of remote computers using powershell

808 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