• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

VPN Loginscript username with VBS

Hi this is my first question in this awesome forum. So here goes.
I've created a VPN package for users with Windows xp with Windows 2003 server with "Connection Manager Administration Kit". I'm using a loginscript in the package that runs post-connect and it works fine. In the loginscript i'm mapping the user's homefolder like this:
************
Set Network = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
DriveLetter5 = "N:" '(My documents)
strNewName5 = "My Documents"
Share5 = "\\vega\users$\" & Network.username & "\My Documents"
Network.RemoveNetworkDrive DriveLetter5, True, True
Network.MapNetworkDrive DriveLetter5, Share5
objShell2.NameSpace(DriveLetter5).Self.Name = strNewName5
************
n.b. I stripped a couple of other things out of the script

This works fine if the user has the same Username on his home computer as he does has at work. But what can I do if the Username on the home computer is "goofy" and the username he uses at work is "peter"?
Any ideas ?

/Njordur
0
Njordur
Asked:
Njordur
1 Solution
 
MtnNtwksCommented:
I'm not really good with scripting, per set.  But you have make your script put the user's network and login password in the script.

To undertand better what I'm talking about, have your user connect to VPN without your script.  They will put in their work login and pasword.  When they try to connect to an actual folder, they will be prompted for the work login and password again.  There will be the check box to "remember password."  Am I explaning myself well?

Once you do this, your script should work as it is.

Of course, the easiest and least convoluted path to solution would be to have the user change his username on the home pc, have the user reboot, and all should be right with the world again :-)
0
 
Ron MalmsteadInformation Services ManagerCommented:
Have a pop-up box instructing them to type their username, instead of pulling it from windows environment.

strUser = InputBox ("Enter your Username.  This is required for access to some network_ resources" , "Username", "",1400,1400)
Set Network = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
DriveLetter5 = "N:" '(My documents)
strNewName5 = "My Documents"
Share5 = "\\vega\users$\" & strUsername & "\My Documents"
Network.RemoveNetworkDrive DriveLetter5, True, True
Network.MapNetworkDrive DriveLetter5, Share5
objShell2.NameSpace(DriveLetter5).Self.Name = strNewName5
0
 
Ron MalmsteadInformation Services ManagerCommented:
strUser = InputBox ("Enter your Username.  This is required for access to some network resources" , "Username", "",1400,1400)

Set Network = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
DriveLetter5 = "N:" '(My documents)
strNewName5 = "My Documents"
Share5 = "\\vega\users$\" & strUsername & "\My Documents"
Network.RemoveNetworkDrive DriveLetter5, True, True
Network.MapNetworkDrive DriveLetter5, Share5
objShell2.NameSpace(DriveLetter5).Self.Name = strNewName5
0
What Security Threats Are We Predicting for 2018?

Cryptocurrency, IoT botnets, MFA, and more! Hackers are already planning their next big attacks for 2018. Learn what you might face, and how to defend against it with our 2018 security predictions.

 
Ron MalmsteadInformation Services ManagerCommented:
Sorry for the typos... and repeat posting.. use this one.

strUser = InputBox ("Enter your Username.  This is required for access to some network_ resources" , "Username", "",1400,1400)
Set Network = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
DriveLetter5 = "N:" '(My documents)
strNewName5 = "My Documents"
Share5 = "\\vega\users$\" & strUser & "\My Documents"
Network.RemoveNetworkDrive DriveLetter5, True, True
Network.MapNetworkDrive DriveLetter5, Share5
objShell2.NameSpace(DriveLetter5).Self.Name = strNewName5
0
 
RobSampsonCommented:
Also, if you don't have that many VPN users, you could keep a list of the computer names, then check them using objNetwork.Computername, and map the user folder accordingly.
Otherwise, prompting for th username, as xuserx2000 has shown, may the only other way.

I am wondering though....if they are not logging with the same username, how are the file permissions handled......

Regards,

Rob.
0
 
NjordurAuthor Commented:
Thanks xuserx2000 you got it right on. So simple :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now