Solved

Active Directory Reporting

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
In-place Upgrading Dirsync to Azure AD Connect
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…
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…

749 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