Getting the number of user accounts in Active Directory on a specific date

I'm using:
get-aduser -filter 'enabled -eq $true' | measure-object | select-object count

Which is great, but is there a means to get an enabled user count for a specific date in the past? I'm attempting to find out how many active users we had on specific dates throughout the year.
Adrian GillottAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ferraristaCommented:
The only way I can think of to have this done without resorting to restoring an existing backup is to use the Active Directory Snapshoot feature (only supported on Windows 2008 and higher), but obviously you'll need to setup a snapshoot first.

An even easier way would be to simply schedule a script to daily dump the list of domain users, so that in the future you can simply query those data offline.
0
ITSysTechSenior Systems AdministratorCommented:
So you could use this to find newly added users,

$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated

And change -30 to when ever the time was so three months ago would be -90 .

Or change whenCreated to what ever your looking for.

EXAMPLE:

$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {Enabled -ge $When} -Properties Enabled



For users:
$When = ((Get-Date).AddDays(-30)).Date
Get-ADUser -Filter {whenCreated -ge $When} -Properties whenCreated

For Groups:
$When = ((Get-Date).AddDays(-30)).Date
Get-ADGroup -Filter {whenChanged -ge $When} -Properties whenChanged

Edit: To make things easier I would use AD Explorer. Linky This is a very powerful search program for AD.
0
Klavs RDeveloper, owner of AlbusBitCommented:
For future use, I can recommend my Active Directory Reporting Tool - AD FastReporter.
There you can generate various AD reports and they are all stored in local database.

For example, you can set up an automatic task that generates user account count reports daily and stores them in a local database, so you can access them at any time.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Klavs RDeveloper, owner of AlbusBitCommented:
You cannot do it with standard Active Directory tools.
Using whenCreated or whenChanged attribute to query AD will not produce the most accurate result because it will not show deleted users.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.