Tuesday, October 10, 2017

Check to see if Active Directory Account is Enabled/Disabled



Simple Tip:
Using the simple PS code below we can check to see if AD account for given user is enabled or disabled. Exploring other  properties with following one liner PS  Get-ADUser $user  -Properties * | gm
will also provide more options. You can check any of the available properties with same way and accomplish the task.





# Check to see if AD User Exist

#(1).Collect user Info
$user               = "Casey.dedeal"
$status           = Get-ADUser $user  -Properties * | select LockedOut
$LockedOut  = $(try {$status} catch {$True})

#(2).Write Output
write-host "()_Checking $user AD Account Status" -f yellow

#(3).Check the account status
If ($LockedOut -eq $True) {
write-host "()_.$user is locked out"
} Else {
write-host "()_.$user is NOT locked out"}





Oz Casey, Dedeal
Systems Engineer
http://smtp25.blogspot.com/ (Blog)
http://telnet25.wordpress.com/ (Blog)
https://twitter.com/Message_Talk (Twitter)

4 comments:

ammarasliraf said...

Great Articles, Thanks Admin.
We are based in Dubai and provides the high level of window glass repairglass interior and exterior works,table top glass and windows glass replacementsupport that well reputed in providing top of the line technical services to a fast growing establishment. We offer you the best quality technical services with utmost commitment to meet your required standard as following below.
dubai glass replacement
glass maintenance works
mirror works in dubai
glass partition in dubai

ammarasliraf said...

Great Articles, Thanks Admin.
We are based in Dubai and provides the high level of window glass repairglass interior and exterior works,table top glass and windows glass replacementsupport that well reputed in providing top of the line technical services to a fast growing establishment. We offer you the best quality technical services with utmost commitment to meet your required standard as following below.
dubai glass replacement
glass maintenance works
mirror works in dubai
glass partition in dubai

Mahesh said...

Really very informative and creative contents. This concept is a good way to enhance the knowledge.
thanks for sharing. please keep it up.

Exchange Server training in gurgaon

Unknown said...


Thank you for sharing great content its great. I am also sharing a content regarding a SEO. if anyone wants to learn
Digital Marketing Course in janakpuri please contact us.