login script after setting up vpn connection

login script after setting up vpn connection

Post by kris hoube » Tue, 09 Aug 2005 21:39:10


we have setup vpn access towards our 2003 server
i want to run a login script after users make a connection to the 2003
server over vpn from their home computers.
this script should map the p: drive to their personal folder (which is under
the shared map personalfolder\loginname)

I found at that running a script after you make a vpn connection can be done
through connection manager (with cmak kit)
But i have a problem with the mapping to the personal folders. here is the
script i am using :

Dim objNetwork
Dim strDriveLetter, strRemotePath, strUserName
strDriveLetter = "p:"
strRemotepath = \\server\personalfolder\"
StrUserName = objNetwork.UserName
Set objNetwork = WScript.CreateObject("Wscript.Network")
objNetwork.MapNetworkDrive strDriverLetter , strRemotePath&strUserName

The problem is that this is not working because the strUserName resolves to
the username used to login locally to the workstation (in Windows XP/2000).
and not to the username used to setup the vpn connection. So this only works
when the username to login locally to the workstation and the username set
in the vpn connection box are the same. Unfortunaly this is not always the
case (as my network users have their own workstations at home and can choose
wathever login name locally). So i need i way to retrieve the username used
to setup the vpn connection towards the 2003 server. Does anyone know how to
get this through scripting or some other way ? Or does anyone has another
solution to solve my problem (the only thing i need to do is to connect the
p: drive to the personal folder of the connected user)

All help would be welcome


Kris Houben
HyperSoft Belgium

login script after setting up vpn connection

Post by Bart Perri » Wed, 10 Aug 2005 05:56:42

objNetwork.UserName should be giving you the Windows login on their local
machine as opposed to the AD credentials used to authenticate to the network
unless they are using Terminal Sessions to a published desktop after VPN.