[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Search active directory by Date Created

Posted on 2009-12-21
6
Medium Priority
?
463 Views
Last Modified: 2012-05-08
I need to search an active directory for objects created recently, Is there such a way?

SBS 2003
0
Comment
Question by:GraemeEvans1
6 Comments
 
LVL 16

Expert Comment

by:Ady Foot
ID: 26094790
Take a look at this article which should help you.  Please shout back if you need any further help.

http://blog.scottlowe.org/2006/10/11/finding-recently-created-active-directory-accounts/

Regards,

Ady
0
 
LVL 24

Expert Comment

by:Awinish
ID: 26094791
For this to know you able to enable auditing on the Domain controller server & if you have enabled auditing,security log will be logged with the event id.
Admanager plus is also good tool.
http://www.manageengine.com/products/ad-manager/
 
References:
http://www.windowsecurity.com/articles/Windows-Active-Directory-Auditing.html
http://support.microsoft.com/kb/814595
http://technet.microsoft.com/en-us/library/cc773388(WS.10).aspx 
0
 
LVL 17

Accepted Solution

by:
Premkumar Yogeswaran earned 2000 total points
ID: 26095007
Hi,
Below script will help you...!

Modify the date:
This denotes Objects created between 01/12/2009 and 31/Dec/2009.

dtmCreationDate1 = "20091201000000.0Z"
dtmCreationDate2 = "20091231000000.0Z"

Also modify Domain
india.microsoft.com to your domain
On Error Resume Next

Const ADS_SCOPE_SUBTREE = 2

dtmCreationDate1 = "20091201000000.0Z"
dtmCreationDate2 = "20091231000000.0Z"

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 Name, whenCreated FROM 'LDAP://dc=india,dc=microsoft,dc=com' WHERE objectClass='user' "  & _
        "AND whenCreated>='" & dtmCreationDate1 & "' AND whenCreated<='" & dtmCreationDate2 & "'" 
Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

Do Until objRecordSet.EOF
    Wscript.Echo objRecordSet.Fields("Name").Value, objRecordSet.Fields("whenCreated").Value
    objRecordSet.MoveNext
Loop

Open in new window

0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 17

Expert Comment

by:Premkumar Yogeswaran
ID: 26095030
hi,
I am using the above script for the same. I beleive it will work great for you.
0
 
LVL 17

Expert Comment

by:Premkumar Yogeswaran
ID: 26095157
HI,
Modify the date and domain then Save this vbscript(Objectdate.vbs).
And open this script via Cscript.
Start run CMD enter
c:\>cscript objectdate.vbs
It will give a list..!

If you want the date of the object created
In ADUC
View -> Advanced option
Now search for the object found in the list in ADUC.
You can find the additional tab "Object" in users property. in that tab you can find the date of object created.
0
 
LVL 4

Author Closing Comment

by:GraemeEvans1
ID: 31668461
Great Script
0

Featured Post

Independent Software Vendors: 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

Let's recap what we learned from yesterday's Skyport Systems webinar.
How to deal with a specific error when using the Enable-RemoteMailbox cmdlet to create a mailbox in the cloud-based service, for an existing user in an on-premises Active Directory.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 …

873 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