Solved

Retrieve Active directory disabled account by Date

Posted on 2013-11-17
5
443 Views
Last Modified: 2013-11-26
I need a script that retrieves Active Directory disabled accounts by Date.

for instance  smith account disabled on 02/12/2013

Any help will be very much appreciated.

Thank you
0
Comment
Question by:jskfan
  • 2
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Will Szymkowski
ID: 39655310
Use the following command below to accomplish this...

Import-module activedirectory
$date = get-date 02/12/2013
get-aduser -filter * -properties * | ? {$_.enabled -eq $false -and $_.whenChanged -eq $date} | select Name, whenChanged, Enabled

Open in new window




Will.
0
 

Author Comment

by:jskfan
ID: 39657112
it does not display anything
0
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 250 total points
ID: 39657211
If the account has been modified since it was disabled then the time will change.

Use the following command and you can sort the time and easily see what accounts have been disabled during the time/day you have specificed.

get-aduser -filter * -properties * | ? {$_.enabled -eq $false} | sort -property whenChanged | select name, enabled, whenChanged

Open in new window


You can also export this to a csv as well see below...

get-aduser -filter * -properties * | ? {$_.enabled -eq $false} | sort -property whenChanged | select name, enabled, whenChanged | export-csv "c:\disabledusers.csv"

Open in new window



Will.
0
 
LVL 5

Assisted Solution

by:Pankaj_401
Pankaj_401 earned 250 total points
ID: 39660737
There is no timestamp for this specifically. Assuming the accounts haven't
been touched since you disabled them, you can look at the whenLastModified also you need to look at  two fields for this:
"userAccountControl" and "whenChanged"
In "userAccountControl" indicates a disabled account"whenChanged"should tell you when the account was disabled.
For more info look at this also: http://blogs.technet.com/b/heyscriptingguy/archive/2005/05/12/how-can-i-get-a-list-of-all-the-disabled-user-accounts-in-active-directory.aspx
0
 

Author Closing Comment

by:jskfan
ID: 39678529
Thank you Guys
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

860 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