Thanks for the advice about the strings. I took over this network and have been making adjustments to a script written in KiXtart about 5 years ago and have been using that as an example for my code. I'm migrating to a single domain/multiple site AD 2003 network and need to do quite a bit of house cleaning which is one of the reasons I'm rewriting the login script. I cleaned it up (but leaving in the error checks)...
Code:
;Script Options
SETOPTION("ASCII", "ON")
BREAK ON
$= SetConsole("Alwaysontop")
Color w+/B
;Delete shares
Use L: /delete /persistent
Use M: /delete /persistent
Use N: /delete /persistent
Use O: /delete /persistent
Use P: /delete /persistent
Use X: /delete /persistent
;Map Personal and Public shares
Use L: "\\ares\" + @USERID
Use X: "\\ares\hsfdrv$"
Use N: "\\ares\daytonpub"
;Group shares
If InGroup("Legal")
Use M: "\\ares\secure$"
AddPrinterConnection("\\janus\Execs_4100")
AddPrinterConnection("\\janus\Execs_Color")
AddPrinterConnection("\\janus\Execs_Lanier")
SetDefaultPrinter("\\janus\Execs_4100")
? "Error" + @ERROR + "Win32 error" + @SERROR
EndIf
If InGroup("Call Center")
Use M: "\\ares\callcenter$"
AddPrinterConnection("\\janus\Call Center 1")
AddPrinterConnection("\\janus\Call Center 2")
AddPrinterConnection("\\janus\Call Center 3")
AddPrinterConnection("\\janus\CC_Lanier")
? "Error" + @ERROR + "Win32 error" + @SERROR
EndIf
If InGroup("CC Mgmt")
Use M: "\\ares\callcenter$"
Use O: "\\ares\ccmgmt$"
Use P: "\\chaos2\training$"
If @USERID="CForester"
AddPrinterConnection("\\janus\Ops")
? "Error" + @ERROR + "Win32 error" + @SERROR
AddPrinterConnection("\\janus\Ops_Lanier")
? "Error" + @ERROR + "Win32 error" + @SERROR
AddPrinterConnection("\\janus\Train_Color")
? "Error" + @ERROR + "Win32 error" + @SERROR
SetDefaultPrinter("\\janus\Ops")
EndIF
EndIf
If InGroup("Sales")
Use M: "\\ares\sales$"
AddPrinterConnection("\\janus\Sales")
AddPrinterConnection("\\janus\Train_Color")
AddPrinterConnection("\\janus\Execs_Lanier")
SetDefaultPrinter("\\janus\Sales")
? "Error" + @ERROR + "Win32 error" + @SERROR
EndIf
Exit
...and ran it locally (as a test user in the Call Center group) from a DOS window and this is what I got.
OFF0000
Error0Win32 errorThe operation completed successfully.
The printers did map when I ran it locally.