Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

VB Script to Map Drives works on some accounts and not others

Hi Experts,

I have the attached VB Script which has been working. However recently I started having problems where it would create the mapped drives for some accounts and not others. No error messages. Please advise on what could be wrong.

Thanks MapNetworkDrives.vbs
0
cimani1000
Asked:
cimani1000
  • 4
  • 2
1 Solution
 
Sigurdur HaraldssonSystem AdministratorCommented:
Are the users that do not get the drives mapped added to the group in a group and not individually? I've had this and then it was that we added a group to the group that was supposed to get the drives. VBS cannot expand memberlist of another group.
0
 
cimani1000Author Commented:
They are mapped as a group. Sometimes it maps other times it does not
0
 
Sigurdur HaraldssonSystem AdministratorCommented:
Is it all groups or specific groups? Same users always or random users?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
cimani1000Author Commented:
Specific groups e.g IT is always OK, HR, Customer Care SOMETIMES not always doesn't map
0
 
Sigurdur HaraldssonSystem AdministratorCommented:
No user is is two groups? And you didn't answer if it always the same users or random users...
0
 
Sigurdur HaraldssonSystem AdministratorCommented:
What does the error log on client computers say?
0
 
spinzr0Commented:
Are you sure they have permissions to the shares and its not a permissions issue?  As a note, turn off the line ON ERROR RESUME NEXT and the error messages will pop up to tell you what went wrong.

Also, if you are using any nested groups you can enumarate all groups the person is a member of first, then process that list rather than just the top level groups.  Here is a sample that I've used.  It adds all group memberships to the dictionary oGroupMembership.  Then, you can process those as:

For Each oGroup in oGroupMembership
     Select Case oGroup
     .....
Next
Set oGroupMembership = CreateObject("Scripting.Dictionary")
oGroupMembership.CompareMode = vbTextCompare
For Each oGroup In oADUser.Groups
    RecurseGroup(oGroup.ADsPath)
Next


Function RecurseGroup(sADsPath)
    On Error Resume Next
    Set oRGroup = GetObject(sADsPath)
    oGroupMembership.Add Replace(oRGroup.Name,"CN=",""), True
    oRGroup.GetInfo
    Err.Clear
    cMemberOf = oRGroup.GetEx("memberOf")
    If Err.Number <> 0 Then Exit Function
    For Each sMemberOf In cMemberOf
        RecurseGroup("LDAP://" & sMemberOf)
    Next
End Function

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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