Solved

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

Posted on 2010-09-03
7
225 Views
Last Modified: 2012-08-13
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
Comment
Question by:cimani1000
  • 4
  • 2
7 Comments
 
LVL 11

Expert Comment

by:sighar
ID: 33602458
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
 

Author Comment

by:cimani1000
ID: 33602492
They are mapped as a group. Sometimes it maps other times it does not
0
 
LVL 11

Expert Comment

by:sighar
ID: 33602499
Is it all groups or specific groups? Same users always or random users?
0
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:cimani1000
ID: 33602509
Specific groups e.g IT is always OK, HR, Customer Care SOMETIMES not always doesn't map
0
 
LVL 11

Expert Comment

by:sighar
ID: 33602527
No user is is two groups? And you didn't answer if it always the same users or random users...
0
 
LVL 11

Expert Comment

by:sighar
ID: 33602528
What does the error log on client computers say?
0
 
LVL 8

Accepted Solution

by:
spinzr0 earned 250 total points
ID: 33603391
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ICACL switch help. How to include current folder 2 37
Problem to open text file 11 73
Identify disabled AD users with PowerShell 6 39
Excel copy picture into Outlook email 7 45
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now