Solved

Active Directory Reporting

Posted on 2009-04-15
3
320 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 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

719 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