Running a Logon script through VPM

Posted on 2010-01-07
Last Modified: 2012-05-08
I am trying to get a user connection through VPN to have their Profile logon script run. We are not using any "VPN Software" just the Windows SBS 2008 VPN. The script listed below is just to map 1 drive.
What steps do I follow to get this to run on VPN Connection?

net use q: /delete
net use q: "\\12Nov2008\Company Files"

Question by:LostInWindows
    LVL 77

    Accepted Solution

    The only way to have it work automatically is if the remote computer joined to the domain. If so, at logon there will be a check box "log on using dial-up connection. Check that and then you will be presented with the option to use the VPN to connect. This then allows the VPN to connect before logon completes. After authentication group policy and logon scripts are then applied.
    On occasion you have to use the following group policies to "tweak" the connection because VPN's are considered slow links.

    Computer Configuration | Administrative Templates | System | Logon  | Always wait for the network at computer startup and login
    Computer Configuration | Administrative Templates | System | Group Policy | Group Policy slow link detection
    Computer Configuration | Administrative Templates | System | Scripts | Run logon scripts synchronously

    If the computer is not a member of the domain, the only option is to have a logon.bat file somewhere such as the user's desktop for them to click after the VPN is connected, which will then map the drives.

    The script/bat file would usually look similar to:
    Net Use /persistent:no
    Net * /delete
    Net Use Z: \\ServerName\ShareName  

    With VPN's name resolution doesn't always work perfectly so the last line is better replaced using the Server's IP such as:
    Net Use Z:  \\\ShareName
    LVL 7

    Assisted Solution

    Hi LostInWindows,

    In this case I think you just need to create a batch or vbscript to mount the network drive.
    Just let them run the script then connect to vpn before accessing the drive.

    Hope this helps.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    For a while, I have wanted to connect my HTC Incredible to my corporate network to take advantage of the phone's powerful capabilities. I searched online and came up with varied answers from "it won't work" to super complicated statements that I did…
    I work for a company that primarily works with small businesses as their outsourced IT vendor. As such the majority of these customers utilize some version of Small Business Server. Due to the economics of running a small business, many of these cus…
    After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
    After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now