Preben Josefsen
asked on
find logon server in a vbs logon script
I need to know which logon server the user is logging on to in a vbs script that I run. In cmd I used %logonserver% but how do I do this in vbs ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi maxmull,
dim wshshell
Dim wshenv
set wshshell = CreateObject("Wscript.Shel l")
set wshenv = WshShell.Environment("VOLA TILE")
msgbox wshenv("LOGONSERVER")
Will do this.
Tim Cottee
dim wshshell
Dim wshenv
set wshshell = CreateObject("Wscript.Shel
set wshenv = WshShell.Environment("VOLA
msgbox wshenv("LOGONSERVER")
Will do this.
Tim Cottee
ASKER
LogonServer = WshShell.ExpandEnvironment Strings("% LOGONSERVE R%")
This seems to work for me.
This seems to work for me.
ShellExecute(0, vbNull, "cmd /c echo %logonserver% >logonserver.txt", vbNull, vbNull, 0)
and then read out "logonserver.txt".