The code below checks if the printer is installed and installs it if it is not installed. It also sets the printer as default if it is not default. It requires the PriMapState() UDF.

 Code:
$printer = "\\server\printer"
If Not PriMapState($printer)
	$rc = AddPrinterConnection($printer)
	$rc = SetDefaultPrinter($printer)
Else
	If PriMapState($printer) <> "2"
		$rc = SetDefaultPrinter($printer)
	EndIf
EndIf


Edited by Mart (2010-03-19 04:15 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.