1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Find out Date/Time when a PC/User was added into 2003 Domain

Discussion in 'Networking (Hardware & Software)' started by harshadd, 2008/05/03.

  1. 2008/05/03
    harshadd

    harshadd Inactive Thread Starter

    Joined:
    2008/03/30
    Messages:
    11
    Likes Received:
    0
    I have a centralise domain, and people from diff regions in country keeps adding PC's and Users to domain. I do not have problem for they doing so, but my need is I want to know how many users/ Pcs added on a particular date. and which all are them.
    Can any 1 on this planet ??????????????
     
  2. 2008/05/04
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    You can use VBScript to grab this information. The user API has a method whenCreated that will return the date the user object was created.

    A google search for "whenCreated VBScript" found this site, and a little looking around in that site got to this page:

    http://activexperts.com/activmonito...ipts/usersgroups/users/#RetruserProfProps.htm

    This gives this code:
    Retrieving User Profile Properties

    Retrieves user account attributes found on the Profile page of the user account object in Active Directory users and Computers.
    Code:
    On Error Resume Next
    Set objUser = GetObject _
      ( "LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com ")
    objUser.GetInfo
     
    strProfilePath = objUser.Get( "profilePath ")
    strScriptPath = objUser.Get( "scriptPath ")
    strHomeDirectory = objUser.Get( "homeDirectory ")
    strHomeDrive = objUser.Get( "homeDrive ")
     
    WScript.echo  "profilePath: " & strProfilePath
    WScript.echo  "scriptPath: " & strScriptPath
    WScript.echo  "homeDirectory: " & strHomeDirectory
    WScript.echo  "homeDrive: " & strHomeDrive
     

  3. to hide this advert.

  4. 2008/05/05
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Sorry, I got called away mid-posting.

    You can modify the script to:
    Code:
    On Error Resume Next
    Set objUser = GetObject _
      ( "LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com ")
    objUser.GetInfo
     
    when_created = objUser.Get( "whenCreated ")
    
    WScript.echo  "User created: " & when_created
    Also you'll need to modify the LDAP call to the Active Directory so as to match your domain. It's the LDAP call allows you to grab as specific user:
    Code:
     "LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com "
    This is broken down into elements.
    dc elements define the domain. ou is the organisational unit, and cn specifies the user. The arrangement is hierarchical as DNS names are. So the highest domain unit "com" is on the right. So we can break this address down as:
    • The two dc elements combine to give use the domain fabrikam.com
    • The user is in an OU called management.
    • And the user name is myerken.
    So if you were looking for a user jbloggs, who is in the users OU, and is a member of the widgets.com domain, you'd change the LDAP call to:
    Code:
     "LDAP://cn=jbloggs,ou=users,dc=widgets,dc=com "
    If you want more information on this sort of thing, I can highly recommend Robbie Allen & Laura E. Hunter's book Active Directory Cookbook, which is excellent and gives a lot of worked examples of how to do this type of thing.
     
  5. 2008/05/05
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    Actually, looking at a sample script from the Active Directory Cookbook:

    http://techtasks.com/code/viewbookcode/1533

    You can see how to modify the script to give you a listing of all the users in any OU and their created date. You first do an LDAP call to grab the OU. Then the users will be child objects of that OU. So combining the two scripts gives:
    Code:
    Set objOU = GetObject( "LDAP://ou=management,dc=fabrikam,dc=com ")
    for each objChildObject in objOU
      Wscript.Echo objChildObject.cn + " was created " + objChildObject.whenCreated
    next
    That will give you a list of all users in the management OU with thier created dates.
     
  6. 2008/05/06
    harshadd

    harshadd Inactive Thread Starter

    Joined:
    2008/03/30
    Messages:
    11
    Likes Received:
    0
    Thanks buddy
    This info was useful, I tried to find out some thing like objChildObject.whocreated or objChildObject.createdBy
    but no success, I need to know who has added User/Computer too

    Also I found objChildObject.whencreated gives correct date but time dose not match,... any light on this??
     
  7. 2008/05/06
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    I don't think the creator is stored within the object.

    As for time - check your server times and regions. If you're in different time zones you may well get different times.
     
  8. 2008/05/06
    harshadd

    harshadd Inactive Thread Starter

    Joined:
    2008/03/30
    Messages:
    11
    Likes Received:
    0
    I have two DCs for same domain 1500 KM away from each others.
    distance between BOM & DEL is 1500km
    I am at BOM and ppl are adding users/computers from DEL
    when i see the time from BOM it is diff.
    Do you mean to say DC at DEL is having diff time at its local than DC at BOM?

    note that BOM and DEL are is same timezone.
     
  9. 2008/05/08
    ReggieB

    ReggieB Inactive Alumni

    Joined:
    2004/05/12
    Messages:
    2,786
    Likes Received:
    2
    I did wonder if the two were in different time zones considering the distances apart.

    However, the point is still relevant. I assume you are outside the US (India?), therefore the server time zone will not be the default US time zone. That means someone would have to manually change the time zone on the servers to get it to the local time. There's room for error there. Either the zone being left at default US on one server, or being set to the wrong time zone, or one server being set to change clock with summer time changes while the others don't (if you have summer time clock changes in your country).

    It might not be the cause of the problem, but time zone setting is the first thing I'd check.
     
  10. 2008/05/11
    harshadd

    harshadd Inactive Thread Starter

    Joined:
    2008/03/30
    Messages:
    11
    Likes Received:
    0
    Thanks for reply
    Yes I am in India. :)
    Time zone is same all over India.
    As u said may be TimeZone is not set same on both the servers, I need to check this out.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.