Solved

Check if user AD account is disabled

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
A procedure for exporting installed hotfix details of remote computers using powershell
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now