|
-
Oct 11th, 2005, 11:15 AM
#1
Thread Starter
Hyperactive Member
[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." 
-
Oct 11th, 2005, 10:15 PM
#2
Thread Starter
Hyperactive Member
DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing." 
-
Oct 11th, 2005, 10:25 PM
#3
Re: logon script
Does this help?
VB Code:
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("ServerName.")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\directory\LDAP")
Set colItems = objWMIService.ExecQuery("SELECT * FROM DS_LDAP_Class_Containment", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "ChildClass: " & objItem.ChildClass
WScript.Echo "ParentClass: " & objItem.ParentClass
WScript.Echo
Next
Next
At least it should give you a hint.
-
Oct 11th, 2005, 10:57 PM
#4
Thread Starter
Hyperactive Member
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." 
-
Oct 11th, 2005, 11:06 PM
#5
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.
-
Oct 13th, 2005, 02:48 AM
#6
Thread Starter
Hyperactive Member
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." 
-
Oct 13th, 2005, 06:01 AM
#7
Thread Starter
Hyperactive Member
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." 
-
Oct 13th, 2005, 06:57 PM
#8
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|