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
Solved

Active Directory Reporting

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This article runs through the process of deploying a single EXE application selectively to a group of user.
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

792 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