Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript Logon script Case AND

$
0
0

I am trying to get CASE to work with AND condition and maybe I just need to do IF THEN ELSE instead but here is what I am trying to accomplish or maybe I am missing something:

Run script User must be part of the groups to map the drive. Problem I am having is in a CASE where an end user is in multiple groups. I want a user to be EXACTLY in the groups specified NOT one or the other. If they are not in both groups then it doesn't need to map them.

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

'Manufacturering Group
        Case "Manufacturing Users"
            objNetwork.MapNetworkDrive "p:", "\\data\share"

'Network Services user group
        Case "Employees A-K"AND"ACL Admins"
            objNetwork.MapNetworkDrive "I:", "\\data\share"
            objNetwork.MapNetworkDrive "H:", "\\home\userdata\"

    End Select
Next


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>