Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Active Directory Reporting

Posted on 2009-04-15
3
Medium Priority
?
322 Views
Last Modified: 2012-05-06
Is there a way of running a report in Active Directory to see all the User Accounts created for 2008?  I can't seem to find an option to do this

Thanks in advance
0
Comment
Question by:Wolf
[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 38

Accepted Solution

by:
Shift-3 earned 2000 total points
ID: 24149312
Paste the script below into a text file with a .vbs extension.  Customize the value of the strContainer variable on line 5 with the distinguished name of the domain or OU to search under.  Running the script will find all user accounts created in 2008 and write the results to a text file.


On Error Resume Next
 
Const ADS_SCOPE_SUBTREE = 2
 
strContainer = "dc=yourdomain,dc=com"
intYear = 2008
strReport = "report.txt"
 
On Error Resume Next
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objReport = objFSO.CreateTextFile(strReport, True)
 
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =   CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
 
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE 
 
objCommand.CommandText = _
    "SELECT ADSPath FROM 'LDAP://" & strContainer & "' " & _
        "WHERE objectCategory='user'"  
Set objRecordSet = objCommand.Execute
 
objRecordSet.MoveFirst
 
Do Until objRecordSet.EOF
    Set objUser = GetObject(objRecordSet.Fields("ADSPath").Value)
    
    If Year(objUser.WhenCreated) = intYear Then
        objReport.WriteLine objUser.distinguishedName
    End If
    
    objRecordSet.MoveNext
Loop
 
objReport.Close

Open in new window

0
 
LVL 1

Author Closing Comment

by:Wolf
ID: 31570498
Thanks!
0
 

Expert Comment

by:Hellbentmaster
ID: 33340241
Hi,

In case the question is still open to anybody, my recommendation is a third party solution called Softerra Adaxes:
http://www.adaxes.com
It includes a vast number of AD reports, and the one particular needed is called "All Users".

Thank you.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

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

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

604 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