Solved

Check if user AD account is disabled

Posted on 2016-09-28
3
35 Views
Last Modified: 2016-09-28
How can I check if a users AD account is disabled?
0
Comment
Question by:Roccat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 13

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

624 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