I have created a script to map a drive based on group membership. Here is a listing of the applicable lines in the script:
' Create required objects
Set wshNetwork = CreateObject("WScript.Network")
Set objSysInfo = CreateObject("ADSystemInfo")
Set wshShell = WScript.CreateObject("WScript.Shell")
set objFSO = createobject("Scripting.FileSystemObject")
' Get users' username
Set CurrentUser = GetObject("LDAP://" & objSysInfo.UserName)
' Get user's group list
strGroups = LCase(Join(CurrentUser.MemberOf))
' Map network drives
If InStr(strGroups, "cn=Corporate") Then
wshNetwork.MapNetworkDrive "Q:", "\\BNESRV1\CORPORATE"
When a user run the script the following error is displayed:
\\bnesrv1\netlogon\logon.vbs(11, 1) Microsoft VBScript runtime error: Type mismatch: 'Join'
The script runs OK as a Domain Admin and I have also tested the script with the user being an administrator on the local machine.
Thanks in advance.