Hi, Trihimbulus.
Something like this will get the job done.
Main Topics
Browse All TopicsI am interested in using vbscript for my logon script in my domain instead of batch. Currently, I have four sites and in my current batch file logon script, there is a " CALL %LOGONSERVER%.bat" command in the script which will map drives specific to that location for office workers who travel all of the offices. The name f each logon script is "DomainControllerName".bat
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.
Thanks all! Each login script will be site specific and I would prefer not to have a universal script for all offices. Yes, my end goal is to go from using a batch file to vb script.
Quick question Rob, where you have:
objShell.Run strLogonServer & ".bat"
should .bat be .vbs, since there will no longer be a logonserver.bat? Also, I suspect I will need to name each logon script, "logon-server".vbs (submit logon-server for actual name of server).
Yes, that's right. If you're going to re-write your batch scripts into VBS files, but keep seperate VBS files, you will need to create <logonserver>.vbs files in place of those batch files.
However, you will then need to change
objShell.Run strLogonServer & ".bat"
to this
objShell.Run "wscript.exe " & Replace(WScript.ScriptFull
so that it forces wscript.exe (the scripting engine) to run the vbs file. The
Replace(WScript.ScriptFull
part just evaluates to the current directory where the first script is being run from....
Regards,
Rob.
Business Accounts
Answer for Membership
by: RobSampsonPosted on 2009-02-11 at 12:16:02ID: 23615617
Hi there. In VBScript, you can use:
l") Strings("% LOGONSERVE R%")
Set objShell = CreateObject("WScript.Shel
strLogonServer = objShell.ExpandEnvironment
objShell.Run strLogonServer & ".bat"
Regards,
Rob.