Two generalized and simplified snippet from our logon script. These two sections exist for all our network printers. We have it all AD group based and we have extensive logging in the script. Groups are generalized and the logging has been removed in the examples below. The printer server gets set earlier in the script and (to keep things nice and simple) the printer name and the share name are the same. We use the PriMapState UDF to check if the printer is already installed and if it is already default or not.

Mapping a printer:
 Code:
;Map printer Printer001
;Check group membership.
If InGroup("Printer001-Default") Or InGroup("Printer001-Extra")
	;Set printer name.
	$printer = "\\" + $printerserver + "\Printer001"
	;Check if the printer is already installed.
	If Not PriMapState($printer)
		;Printer is not installed. Add printer.
		;Add entry to text log file
		$rc = AddPrinterConnection($printer)
	EndIf
EndIf


Setting a default printer:
 Code:
;Set default printer Printer001
;Check group membership.
If InGroup("Printer001-Extra")
	$printer = "\\" + $printerserver + "\Printer001"
	;Check if the printer is already set as default.
	If PriMapState($printer) <> "2"
		;Set default printer.
		$rc = SetDefaultPrinter($printer)
	EndIf
EndIf
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.