need step by step procedure to setup logon scripts in Win 2003 server

Posted on 2006-04-14
Last Modified: 2010-04-18
Hello - I am new to 2003 server - active directory.

I'd like to setup a server to use logon scripts.

I just want users drives to be automatically mapped.

As I said, I'm new to this so complete step by step instructions would be very helpful.

thank you in advance for your assistance,


Question by:kpdonahue
    LVL 95

    Accepted Solution

    Create a text file ending in .bat - for example, logon.bat

    Then for each drive you want to map, use a set of lines like this:

    REM - check if X: is already mapped, if so, delete it.
    if exist x:\ net use x: /delete
    REM - map X: to the share sharename on the server myserver
    net use x: \\myserver\sharename

    Then place this file on the domain controller in:
    c:\windows\sysvol\sysvol\<your domain name>\scripts

    Finally, on each user who you want to use the script, go to their account properties and set the logon script to be the same name as the text file - no path.

    So if you used the sample I gave above, then the logon script would be:
    LVL 95

    Assisted Solution

    by:Lee W, MVP
    You can also use Group Policy scripts as described here:

    Note: there are multiple types of scripts - the two most common are batch and vbscript.  Batch is generally a simple grouping of commands you would type on the command line, vbscript is like writing a program.  You can do everything in vbscript, but it generally requires a good knowledge of visual basic to do things effectively.  And the code required is greater - the same kind of script as I gave you (mine is batch) done in vb would be 4-8 lines longer.
    LVL 7

    Assisted Solution

    lets take an example. Assume that you have a user with the name "kerry" and there is folder with the name "kerry_files" (shared folder) in your server and when kerry logs into his computer this folder should be mapped as z drive in his computer.

    SCRIPT you can use .VBS (VB SCRIPT) or .BAT file. this example is with VB SCRIPT.

    ' Beginning of the script

    Option Explicit
    Dim objNetwork
    Dim strDriveLetter, strRemotePath, strUserName
    strDriveLetter = "Z:"
    strRemotePath = "\\computer name\kerry_files"
    Set objNetwork = WScript.CreateObject("WScript.Network")
    objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

    ' End of the script.

    paste the above script  in notepad and save as logon.vbs

    now copy this file in your server to the following location

    c:\windows\sysvol\sysvol\your domain name\scripts

    * your domain name is the name of your domain.

    no open active directory users and computers

    right click on the username kerry and select properties

    and give the logon script name in the box "LOGON.VBS"

    You are done


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
    This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now