I am trying to map drives based on groups. I am using the 'Hey Scripting Guy Article' to do so. I am getting an error on one of my groups when I start my 'For Each' loop stating 'Object is not a Collection'. I know this is because when the group in question is 'NoAccess' it returns a string instead of an array. I am not sure how to cleanly get around this.
There are three groups, 'Card Dept', 'Cardsource' and 'NoAccess' -- NoAccess is the troublemaker. There are 2 users who are members of this group.
I dont want to start doing if statements before my select case call because if I ever need to add another group, I will have to det开发者_JS百科ermine if it will return an array or string, and then add another layer of If statements to determine how to map the drive. If I MUST do that, then I must, but I was hoping for a cleaner way to map drives based on groups. Below is a pastebin to the relevant code.
http://pastebin.com/cazSPjjD
Try doing error capture: invoking "On Error Resume next" late in the code and catching the errors immediately after the offending statement.
精彩评论