precioustony
Technical User
I have this script that I want to use in mapping drives and printers but it is giving me errors. It runs well when am logged in as an administrator but with an ordinary domain user account it generates errors and of course I cannot give users admin rights. the error generated is:
Type mismatch: 'Join'
Code: 800A000D
Here is the full VBScript:
'===========================================================
Option Explicit
Dim server
Dim drive
Dim wshNet
Dim ADSysInfo
Dim CurrentUser
Dim strGroups
Dim GroupMember
Dim a
Const SYSTEMS = "cn=colsystems"
server = "\\server1"
drive = "\\server1\test1"
Set wshNet = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
Select Case GroupMember
case a = InStr(strGroups, SYSTEMS)
Systemssub
End Select
Sub Systemssub
wshNet.MapNetworkDrive "f:","\\server1\test2"
wshNet.AddWindowsPrinterConnection "\\server1\hp"
wshNet.SetDefaultPrinter "\\server1\hp"
End Sub
WScript.Echo("Script completed successfully")
WScript.Quit
---
Type mismatch: 'Join'
Code: 800A000D
Here is the full VBScript:
'===========================================================
Option Explicit
Dim server
Dim drive
Dim wshNet
Dim ADSysInfo
Dim CurrentUser
Dim strGroups
Dim GroupMember
Dim a
Const SYSTEMS = "cn=colsystems"
server = "\\server1"
drive = "\\server1\test1"
Set wshNet = CreateObject("WScript.Network")
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))
Select Case GroupMember
case a = InStr(strGroups, SYSTEMS)
Systemssub
End Select
Sub Systemssub
wshNet.MapNetworkDrive "f:","\\server1\test2"
wshNet.AddWindowsPrinterConnection "\\server1\hp"
wshNet.SetDefaultPrinter "\\server1\hp"
End Sub
WScript.Echo("Script completed successfully")
WScript.Quit
---