Question

Locked

vbs script logon too many mapped drives

By BroadwayTech ·
have a midsize company that really likes to get organized.. problem is we have too many mapped drives... one of the higher ups will want access to enough to run out of letters! Question: how do I create a mapped drive where they click and when it opens it contains shortcuts or links to other mapped resources? My vbscript is relatively simple mapping drives according to security group they are in.. one security group for each shared folder. I have heard of junctions, subst, and others.. what is the best method for a clean script with little code? I also have this join statement that needs at least two security groups otherwise it returns an error. but first question first. thanks. windows 2008 server with xp clients. and I do know 2008 does mappings but how detailed?

This conversation is currently closed to new comments.

11 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Distributed File System

by BFilmFan In reply to vbs script logon too many ...

DFS is the answer.

http://www.microsoft.com/windowsserver2003/technologies/storage/dfs/default.mspx

Collapse -

appreciate the suggestion

by BroadwayTech In reply to Distributed File System

I appreciate the suggestion but was looking at the a vbs solution only. I will surely suggest this... anyone else?

Collapse -

Memberof Attribute

by BFilmFan In reply to appreciate the suggestion

You will need to make LDAP calls to get the Memberof attribute to determine security grou membership.

See http://www.rlmueller.net/MemberOf.htm

Collapse -

memberof attribute

by BroadwayTech In reply to Memberof Attribute

that is already in the script... maybe I am not being clear or no one is reading the post carefully.. I have a script that does that already... I need to know if it is possible to map a drive to folder that has other shares in it... this way a user with multiple mapped drives won't run out of drive letters.. and i need these "shortcuts" to be created dynamically according to permissions..

Collapse -

Or you could

by IC-IT In reply to memberof attribute

have folders with different permissions.
Or have labelled folders according to security groups.

Collapse -

nooo....

by BroadwayTech In reply to Or you could

I have to stick with vb.. here is my script:
Option Explicit
'Declare variables
Dim objNetwork, objUser, CurrentUser
Dim strGroup

' Initialize Groups with Const
Const Accounting_Group = "cn=Accounting"
Const Private_Group = "cn=SM_Private"
Const Public_Group = "cn=SM_Public"
Const Technology_Group = "cn=SM_Technology"
Const Corporate_Group = "cn=SM_Corporate"

' Create objects and extract strGroup values
Set objNetwork = CreateObject("WScript.Network")
Set objUser = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & objUser.UserName)

objNetwork.MapNetworkDrive "Q:", "\\server\Data"
objNetwork.MapNetworkDrive "I:", "\\server\Common"

strGroup = LCase(Join(CurrentUser.MemberOf))
' If logic testing strGroup for the values in Const groups
If InStr(strGroup, lcase(Corporate_Group)) Then
objNetwork.MapNetworkDrive "J:", "\\server\Corporate"
objNetwork.AddWindowsPrinterConnection "\\server\Executive-Suite"
objNetwork.SetDefaultPrinter "\\server\Executive-Suite"

ElseIf InStr(strGroup, lcase(Accounting_Group)) Then
objNetwork.MapNetworkDrive "K:", "\\server\Accounting"
objNetwork.AddWindowsPrinterConnection "\\server\Dell1815dn02"
objNetwork.AddWindowsPrinterConnection "\\server\XeroxWC7345"
objNetwork.SetDefaultPrinter "\\server\Dell1815dn02"

ElseIf InStr(strGroup, lcase(Public_Group)) Then
objNetwork.MapNetworkDrive "M:", "\\server\Public_Equity_Market"
objNetwork.AddWindowsPrinterConnection "\\server\1815dn"
objNetwork.AddWindowsPrinterConnection "\\server\XeroxWC4150"
objNetwork.SetDefaultPrinter "\\server\1815dn(trade)"

ElseIf InStr(strGroup, lcase(Private_Group)) Then
objNetwork.MapNetworkDrive "N:", "\\server\Private_Company_Market"
objNetwork.AddWindowsPrinterConnection "\\server\1815dn(trade)"
objNetwork.AddWindowsPrinterConnection "\\server\1815dn(trade)"
objNetwork.SetDefaultPrinter "\\server\1815dn(trade)"

ElseIf InStr(strGroup, lcase(Technology_Group)) Then
objNetwork.MapNetworkDrive "T:", "\\server\Tech"
objNetwork.AddWindowsPrinterConnection "\\server\Technology"
objNetwork.AddWindowsPrinterConnection "\\server\Dell3110"
objNetwork.SetDefaultPrinter "\\server\Technology"


End If

WScript.Quit

so two questions: the lcase or join statement gives me an error if the user is not in at least two security groups.

other question: is it possible to within script map a folder like the above script does. But within that folder have either shortcuts or somehow map other mapped drives inside of it? the reason for this is that some users have a lot of access to resources and all of the drive letters get used up. No I don't want to create a root share above all of these folders, i do not want to use dfs, or anything but the above script. I've heard that such a thing is possible using commands like sust, junctions, or something along that nature.. suggestions?

Collapse -

Create a network shortcut folder

by LarryD4 In reply to vbs script logon too many ...

We just created a network share that have folders for each division. We put shortcuts to all of the shares needed in their for each division.

We then put a shortcut to the share for that divsion on the desktop with a simple script that test what division they are in.

Collapse -

Can you show me?

by BroadwayTech In reply to Create a network shortcut ...

Really? Can I see how you do the security group checking and how you make these shortcuts? so you don't have to map them?

Collapse -

Well how well do you know VBS?

by LarryD4 In reply to Can you show me?

The logon script itself is a VB Script that tests the user logging in to see what divsion they are in based on what Groups the belong to, such as IT, HR etc.

Then it simply puts a short cut called IT shortcuts on the desk top that points to that divisions folder on the share.

Then you just drop whatever shortcuts you want for that division or dept, in to that specific folder.

This the bind in VBS to connect to the AD schema

Set objSystemInfo = CreateObject("ADSystemInfo")

Then you have to test for which group

For Each Group In ObjUser.MemberOf


If Group = "CN=Company USB" & sGroups Then
USB = "Yes"
End If

If Group = "CN=IT" & sGroups Then
Call ITO()
End If

If Group = "CN=Executive Team" & sGroups Then
Call Exec()
End If

If Group = "CN=HR" & sGroups Then
Call HR()
End If

Then in each division sub call

you would have say for HR

'Set Shell = CreateObject("Wscript.shell")
Set oMyShortcut = WSHShell.CreateShortcut("HR Shortcuts")
oMyShortcut.WindowStyle = 3 '&&Maximized 7=Minimized 4=Normal
oMyShortcut.TargetPath = "\\<servername>\<sharename>\HR"
oMyShortCut.Save

Its a bit crude cause I had to leave a lot of stuff out for security reasons but thats the gist of it.

Collapse -

So...

by BroadwayTech In reply to Well how well do you know ...

so in essence you are not mapping any drives with this script but just making the shortcuts. How do the shortcuts work if no drives are mapped?

Back to Networks Forum
11 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums