Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Map Network Paths to Available Drive Letters

Status
Not open for further replies.

uxphreak

IS-IT--Management
Nov 24, 2006
2
US
Hello,

I have a log on script that I need to tweak to be able to map a drive letter to multiple network shares based on the users' group membership. I assign 2 default drive mappings to all users: R: for the Departments' Restricted Folder, and P: for the Company Public Folder. S: is mapped for users who require a specific network share and who belong to a specific group. The remaining network shares should be mapped for users who belong to other groups/departments, starting with T:.

This is simple for those users who are members of one group/department, however, I have numerous users who are members of more than one group/department and need a way to automatically map the network shares to the next available drive letter, starting from T:. For instance, Bob is a member of the Bulk/Bakery, Store1, and DeptMgr groups/departments. Bob needs to access each departments' network share, and therefore would have T:, U:, and V: mapped to each respective share.

The attached code snippet is a portion of the code from my log on script. Currently I need to add the While loop to each Select Case conditional statement for each group/department in order to properly map the shares to an available drive letter, but I'm hoping to shorten and optimize the code so that all groups are cycled through until they are all processed. Currently I have 20 groups/departments.

Thanks for your assistance.

==================================

'Map the available drive letters starting from T: to other Network Shares and create the Desktop Icons

Set objFS=CreateObject ("Scripting.FileSystemObject")
Set colDrives=objFS.Drives
letter=Asc("t")

For Each GroupObj In UserObj.Groups
Select Case GroupObj.Name
Case "Bulk Bakery"

While objFS.DriveExists(Chr(letter)+":")
letter=letter+1
Wend
strDrvLtr = UCASE(Chr(letter)) & ":"

WSHNetwork.MapNetworkDrive strDrvLtr, "\\<SERVER>\Public\Bulk",True
Set objShortCut = WSHShell.CreateShortcut(strDesktopFolder & "\Bulk Public Folder.lnk")
objShortCut.TargetPath = strDrvLtr
objShortCut.Description = "Bulk Public Folder"
objShortCut.Save
 
I think your code looks good. I would however caution using a randomly assigned drive letter.

One would HOPE that your users have been trained and do include links to documents rather than attaching them in email internally. If drive letters are different then the method you are using would cause problems.

I would recommend you make a matrix of all groups. Then try to assign a different drive letter to each group.

If you can identify groups that would never have the same person as a member, then you could duplicate drive letters there.

Assuming local drives could go up to the letter G, you should still have 19 driver letters to play with.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top