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

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

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,"

\\server\username$

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)
0
Dragonfyre2825
Asked:
Dragonfyre2825
  • 2
1 Solution
 
ngailfusCommented:
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) 
   Next 
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

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

objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
0
 
Dragonfyre2825Author Commented:
Fantastic. Thank you!
0

Featured Post

Independent Software Vendors: 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!

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