Results 1 to 8 of 8

Thread: [RESOLVED] logon script

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Resolved [RESOLVED] logon script

    Please read this and if u understand it please explain me how to do it or if it is a small application, please make one and give me. This is from an email i got from my friend.

    "The application must execute at user logon
    Basically when a user logon it need to read an attribute in the schema of the user eg in vb script it will be getobject ("<A href="ldap://DN NAme of object">LDAP://DN NAme of object") all my users are in one OU so basically you search for the user info in the schema..
    The value of he schema attribute is then pass to the registry

    eg you can do this an i can change the parameters
    User ABC logs on to the network... The scripts the will take user ABC user info and bind to AD User Info and get the attribute value to add to the registry... Once it gets the attribute it adds it to the registry... if the value in AD is blank it does nothing... if the value in the AD is different that the on in the HKCU reg key change it to the AD values... If no value in HKCU change to the AD values... Hence the AD value is always presidence..."
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: logon script

    Nobody understands this?
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: logon script

    Does this help?
    VB Code:
    1. On Error Resume Next
    2.  
    3. Const wbemFlagReturnImmediately = &h10
    4. Const wbemFlagForwardOnly = &h20
    5.  
    6. arrComputers = Array("ServerName.")
    7. For Each strComputer In arrComputers
    8.    WScript.Echo
    9.    WScript.Echo "=========================================="
    10.    WScript.Echo "Computer: " & strComputer
    11.    WScript.Echo "=========================================="
    12.  
    13.    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\directory\LDAP")
    14.    Set colItems = objWMIService.ExecQuery("SELECT * FROM DS_LDAP_Class_Containment", "WQL", _
    15.                                           wbemFlagReturnImmediately + wbemFlagForwardOnly)
    16.  
    17.    For Each objItem In colItems
    18.       WScript.Echo "ChildClass: " & objItem.ChildClass
    19.       WScript.Echo "ParentClass: " & objItem.ParentClass
    20.       WScript.Echo
    21.    Next
    22. Next

    At least it should give you a hint.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: logon script

    I havent written any network programs yet. Can u please make a project for me?
    It also need some schema to be put in regstry. What is a 'schema'? I couldnt understand the above code fully.
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: logon script

    A schema is a design, but if you are using an Active Directory structure, then you don't want to store anything in the registry, I would think. Explain what you are trying to do, and maybe someone would be able to help.

    Nobody is going to 'write you a project' but we will try to help you when you get stuck.

    I don't think this is a beginner's project, so maybe you should consider whether or not you want to go thru the trouble of trying to understand it.

    You can paste that code into notepad, and change the ServerName to the server that contains the AD's name, and save it as a .vbs file. Then, when you double-click on it, it should open in IE and run, so it is actually a project.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: logon script

    project explained here:

    1. Using the name translate in VB convert the user login to the DN Name so you can bind to the value in Active Directories eg..


    ' Constants for the NameTranslate object.

    Const ADS_NAME_INITTYPE_GC = 3
    Const ADS_NAME_TYPE_NT4 = 3
    Const ADS_NAME_TYPE_1779 = 1

    ' Specify the NetBIOS name of the domain.

    strNetBIOSDomain = "MyDomain"

    ' Specify the NT name of the user.
    strNTName = "TestUser"

    ' Use the NameTranslate object to convert the NT user name to the
    ' Distinguished Name required for the LDAP provider.
    Set objTrans = CreateObject("NameTranslate")

    ' Initialize NameTranslate by locating the Global Catalog.
    objTrans.Init ADS_NAME_INITTYPE_GC, ""
    ' Use the Set method to specify the NT format of the object name.
    objTrans.Set ADS_NAME_TYPE_NT4, strNetBIOSDomain & "\" & strNTName

    ' Use the Get method to retrieve the RPC 1779 Distinguished Name.
    strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)

    ' Bind to the user object in Active Directory with the LDAP provider.
    Set objUser = GetObject("LDAP://" & strUserDN)

    2. Bind to the object and retrieve the attribute eg
    set x = getobject(<A href="ldap://dn path">LDAP://dn path")
    registry_value = x.attribute 'where attribute is the value to get in Active Directory

    3. Conditions the registry path will always be present but the value of the registry may not.
    If the value that is return from AD for attribute is Null either the script
    If the Value that is return from AD is different than the Registry change the Registry value

    4. Create a log in C:\temp and put the results this can be done using filesystemobject
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: logon script

    This is an explanation i got from another source. Can anybody form this into vbscript a file?
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: logon script

    no hope?
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width