Oh, forgot a closing bracket...
Main Topics
Browse All TopicsI need a simple VB scripted that will query and active directory domain controller for the login script path from thier users profile information.
I am using the following to get the username from the local computer....
Set WshShell = CreateObject("WScript.Shel
Set objEnv = WshShell.Environment("Proc
strUsername = ObjEnv("Username")
I need to know how to do an LDAP query using the username to retrieve the login script information.
Any help would be greatly appreciated
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
That works great, and simple. Since you obvoiusly know more that I do, let me ask you the next part. I want this script to be versitile as possible. Is there a way to use DNS to find a domain controller? If it cant find a domain controller to return a message saying the domain isnt available. If a DNS entry is returned to test to make sure its active? Thoughts?
I'm not so sure I follow.....you *can* obtain a list of all domain controllers by connecting to the Active Directory, but it sounds like you want to check a DC first....
In that case, you could ping the server listed in the DOS variable "%LOGONSERVER%", and you'd know which server was authenticated to....
Is that sort of what you're after?
Regards,
Rob.
Just to post my final script for others.....
This script will get the login script path information for a Active Directory user and execute it.
dim strScriptPath
Set objADSysInfo = CreateObject("ADSystemInfo
Set objUser = GetObject("LDAP://" & objADSysInfo.UserName)
strScriptPath = objUser.ScriptPath
Set objShell = CreateObject("WScript.Shel
objShell.Run "%LOGONSERVER%\NETLOGON\" & strScriptPath
strScriptPath = ""
Business Accounts
Answer for Membership
by: RobSampsonPosted on 2008-11-03 at 20:49:56ID: 22873618
Hi, if you are running a script locally, you can use the code below to return the path to the current user's logon script.
echnet/scr iptcenter/ resources/ qanda/sept 05/hey0908 .mspx
If you're after an example of how to clear that value for all users in your AD, you can look here:
How Can I Clear the Logon Script Path for All My Users?
http://www.microsoft.com/t
Regards,
Rob.
Select allOpen in new window