I've amended Witto's code so that it returns an error if the mapping fails:
Code:
;Script Options
If NOT @LOGONMODE
	Break On
EndIf
Dim $RC
$RC=SetOption("Explicit", "On")
$RC=SetOption("NoMacrosInStrings", "On")
$RC=SetOption("NoVarsInStrings", "On")
$RC=SetOption("WrapAtEOL", "On")
 
Dim $sPrintServer	$sPrintServer="ServerName"
Dim $sPrinterName	$sPrinterName="PrinterName"
 
;Map Printer
If InGroup("GroupName")
	$RC = AddPrinterConnection("\\"+$sPrintServer+"\"+$sPrinterName)
	If @ERROR "ERROR: Cannot map printer "+$sPrinterName+" on "+$sPrintServer+" Reason: ["+@ERROR+"] "+@SERROR+@CRLF EndIf
EndIf


Make sure that the printer name and the share name are identical on the print server, otherwise it will cause you problems.