We help IT Professionals succeed at work.
Get Started

Using a script to map multiple drives based on group membership

825 Views
Last Modified: 2013-12-24
Good Afternoon,
I have a very limted knowledge of scrupting using VBS however I was able to piece together the below script but it will only map a single network drive

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")

strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)

For Each strGroup in objUser.MemberOf
    strGroupPath = "LDAP://" & strGroup
    Set objGroup = GetObject(strGroupPath)
    strGroupName = objGroup.CN

    Select Case strGroupName
        Case "AOD Users"
            objNetwork.MapNetworkDrive "M:", "\\QPRCAOD01\AOD"
       
       
    End Select
Next

How can I expand on this so that it will map more than one drive>  For example I would like to map up to five different drive letters using one script.  One drive would map to M, one to S, one to T, and another to H.  A user who is a mamber for the drives M,S, and T would get those drives only but not the T abd H drives.

Any help would be appreciated
Comment
Watch Question
Senior Engineer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE