Home > Ask the Windows Server Experts > Archive: Microsoft Active Directory Questions & Answers > Finding the creation date of objects
Ask The Windows Server Expert: Questions & Answers
EMAIL THIS

Finding the creation date of objects

Paul Hinsberg EXPERT RESPONSE FROM: Paul Hinsberg

Pose a Question
Other Windows Server Categories
Meet all Windows Server Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 20 November 2004
Where can I find the creation date of an object, like Users? I want to make a script where the filter is the creation date of the User. I hope you can help me.

>
Here is a snippet of a VBScript:
strContainer = "users"
strName = "phinsberg"


dim strname
On Error Resume Next
'***********************************************
'* Connect to an object *
'***********************************************
Set objRootDSE = GetObject("LDAP://rootDSE")
If strContainer = "" Then
 Set objItem = GetObject("LDAP://" & _
 objRootDSE.Get("defaultNamingContext"))
Else
 Set objItem = GetObject("LDAP://cn=" & strName & "," & strContainer & "," & _
 objRootDSE.Get("defaultNamingContext"))
End If
'***********************************************
'* End connect to an object *
'***********************************************
WScript.Echo VbCrLf & "** General Properties Page**"
WScript.Echo "** (Single-Valued Attributes) **"
strname = objItem.Get("name")
WScript.Echo "name: " & strname

WScript.Echo VbCrLf & "** Object Properties Page**"
WScript.Echo "** (Single-Valued Attributes) **"
strwhenCreated = str(objItem.Get("whencreated"))
WScript.Echo "whenCreated: " & strwhenCreated
strwhenChanged = objItem.Get("whenChanged")
WScript.Echo "whenChanged: " & strwhenChanged
The rather odd thing is the unusual inconsistency with actually retrieving the dates at times. This script is looking for the OU=users and the object=phinsberg. You can use the same process iteratively to retrieve multiple users. Like I said though, the problem is the seemingly inconsistent behavior of retrieving the date attributes. You can view the information on a user account from the ADSIEdit MMC, but the ADSI script engine sometimes has a problem.

Additional Expert Help:
Be sure to check our Answer FAQ for more expert advice.
For faster answers, visit ITKnowledge Exchange.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Microsoft Active Directory Scripting
Scripting domain controller installations: A must for Server Core
Introducing Active Directory to Windows PowerShell
Simple WMI tricks for AD administrators
Active Directory LDAP scripting made simple
Extracting Active Directory info quickly and easily with LDIFDE
Scripting School: Connect scripts to remote computers
Taking computer names as arguments
Using WSH Controller
Connect scripts to remote computers: Summary
Reading computer names from Active Directory

Archive: Microsoft Active Directory
Creating user home directories on a Windows 2003 network
Changing NTDS links with Active Directory
Can I add a Win2003 Server to an NT4 domain without AD?
Filtering workstation logon events to log only user activity
Error of event ID 7031 when attempting to move mailboxes
Child domains not finding global catalog
Duplicating Windows 2000 domain as Windows 2003 test environment
Backward checking permission for groups in Active Directory
How can I configure user profiles on a Windows 2000 Server?
Changing domain controller names in Windows 2000 Server

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Windows Server Solutions - Intel Hardware Solutions
HomeTopicsBlogsITKnowledge ExchangeTipsNewsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2004 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts