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

client logon scripts

Windows XP.

Is it possible to run a script that will create a vpn connection and map a network when a user logs onto a client machine? If so where would I place the script?

1 Solution
i dont think we can do the VPN connection in login script . but the mapping can be done in two if you have a windows 2000 Domain then you need to add logon scipt by gpoing to AD users and compters and use properties and then pofile tab and then logon scipt . but the file shld be in C:/windows /sysvol/ your domain.com/script . the other way is to use the Group policy .

Hope this helps
If your client is going to log on remotely most of the time I suggest you map the network drive manually. Because if he/she is not connected to your network, he will be logging onto his machine locally and will not pick up the script anyway. VPN will not pick the script up either.

He has to manually map the drive (either when he is in the network or VPN in) and tick the Reconnect box. However he will see an error saying "Unable to map network drive" whenever he starts his machine (this is because Windows check all mapped network drive during boot up and it will not able to find the mapped drive before the user VPN in). But he should be able to access the drive ONCE he has VPN in.
Ron MalmsteadInformation Services ManagerCommented:
Here's a script to create a vpn connection...edit as necessary..
I would run this from a batch file...
strCompanyName = "Yourcompany"
strIPaddress = ""

Set WshShell = Wscript.CreateObject("Wscript.Shell")
VPN1 = WshShell.Run("cmd /c ncpa.cpl")
Wscript.Sleep 3000
WshShell.SendKeys "%{F}"
WshShell.SendKeys "N"
WshShell.SendKeys "{ENTER}"
WshShell.Sendkeys "%{o}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "%{V}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys strCompanyName
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "%{D}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys strIPaddress
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "%{S}"
WshShell.SendKeys "{ENTER}"

I would launch this script via batchfile....assign the batch file to run at logon... This will ensure that each user only runs this script once, per machine. And put the script file on a network share.
Example Batch file...

IF EXIST "\\Server\Share\LogonScript\%username%.%computername%.txt" EXIT

xcopy \\Server\Share\LogonScript\VPN\vpnscript.vbs c:\ /y
cscript c:\vpnscript.vbs
echo "%username%.%Computername%.txt > "\\Server\Share\LogonScript\"
Ron MalmsteadInformation Services ManagerCommented:
To map the network drive they will have to be logged onto the vpn...
You can put a delay at the end of the script if you want to....

Wscript.Sleep 20000

This will delay 20 seconds...  Give them enough time to enter username and password...  Then the last line of the batch file would be..    NET USE P: \\Server\Share
Once the drive is mapped...you won't have to remap it each time....then when they logon to the vpn it will be available always.
SolugaAuthor Commented:
Thanks, sorry about he delay

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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