Try my UDF. I know this code is solid. Does it work?
for testing purposes you will need to comment out the logging lines or load the UDFs (available in the UDF Library.)
What is the LogonDomain? Is it the same domain as the group? Is this a domain global group? Did you try "domain\group"?
Code:
if INGROUP("GROUP")
? "LogonDomain: @Ldomain + " User: " + @userid + " is in group"
MapDrive ("K:", "server", "share")
else
? LogonDomain: @Ldomain + " User: " + @userid + " is NOT in group"
endif
Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell
Color c+/n
If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\$Server\$Share"
If @error=0
color g+/n
$x=" - Success"
"$x"
If val($DOS) >= 5
$shell=createobject("shell.application")
$shell.namespace($Drive+"\").self.name=$Share + " on '" + $Server + "'"
$shell = 0
Endif
Else
color r+/n
$x=" - Failed: Error @error"
"$x"
$ErrorState=1
Endif
WriteLog ($LogText + $x)
WriteLog2("%temp%\MapDrive.log",$LogText + $x,1)
Color w+/n
Else
WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction