开发者

Mapping Drives based on Group Membership

开发者 https://www.devze.com 2023-01-24 15:21 出处:网络
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 Co

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消