Logon Script for mapping to a network shared drive, hidden folder

Posted on 2009-02-23
Last Modified: 2012-05-06
First I am having a blonde moment and can't remember what the process is actually called when you "map to a network drive, but a hidden folder,"


secondly, does someone have a good, perhaps short, script to implement this. I would like the script to automatically 'discover' which folder to map to based upon the user name.

thirdly, on the topic of network shared drives, once the user is inside the hidden folder how can I ensure that they are not allowed to go up a level out of their "directory."

I am running windows 2k8, with all winxp clients.

thanks in advance.
~dragonfyre2825 (NML)
Question by:Dragonfyre2825
    LVL 6

    Expert Comment

    If the drive is mapped to the highest level they are allowed to go, they should not be able to go up any higher than that.  For example, if you have a mapped U drive and you try to go up a level from the "root" of U you would end up back at My Computer.  As for a simple script, attached is what we use to map users to their files on the server.
    '******************Drive Mapping**********************
    On Error Resume Next
    Dim colDrives 'Currently mapped network drives
    Set objNet = CreateObject("WScript.Network")  
    '***********Delete Previous Mapped Drives*************
    Set colDrives = objNet.EnumNetworkDrives 
    If colDrives.Count <> 0 Then 
       For i = 0 To colDrives.Count - 1 Step 2 
          objNet.RemoveNetworkDrive colDrives(i) 
    End If 
    '**********Map New Drives Based on Username***********
    Set ObjNet = CreateObject("WScript.Network")
    Dim strUser, strDriveLetter, strRemotePath
    strUser = ObjNet.UserName
    strDriveLetter = "U:" 
    strRemotePath = "\\SERVER\USERS\" & strUser & "\My Documents"
    Set objNetwork = CreateObject("WScript.Network") 

    Open in new window

    LVL 6

    Accepted Solution

    Sorry that is an incomplete script.  It is missing the last line.

    objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

    Author Comment

    Fantastic. Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    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!

    If you migrate a Terminal Server licenses server inside the 2008 server family, you can takte advantage of the build-in migration tool. If you like to migrate an older 2003 Server (and the installed client CALs) to a 2008 R2 server for example, you …
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    This tutorial will give a short introduction and overview of Backup Exec 2014 and the additional features that have been added over its predecessor Backup Exec 2012. As with Backup Exec 2012, the Backup Exec button in the upper left corner. From her…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 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

    14 Experts available now in Live!

    Get 1:1 Help Now