client logon scripts

Posted on 2007-07-26
Last Modified: 2010-05-18
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?

Question by:Soluga
    LVL 11

    Expert Comment

    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 . the other way is to use the Group policy .

    Hope this helps
    LVL 23

    Expert Comment

    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.
    LVL 25

    Expert Comment

    by:Ron M
    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\"
    LVL 25

    Accepted Solution

    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 won't have to remap it each time....then when they logon to the vpn it will be available always.
    LVL 1

    Author Closing Comment

    Thanks, sorry about he delay

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
    Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now