Hi Roberto,

Welcome to the board.

You have some small typos in your script. If the InGroup function returns 0 the user is NOT in the group but in your setup they do get the printer. Second thing is that there is a space between the $ and print when setting the printer name. See below for the "fixed" code.

 Code:
If InGroup("Group01")
	$print = "\\Server03\HP-Group01"
	If AddPrinterConnection($print) = 0
		SetDefaultPrinter($print)
	EndIf
EndIf


If you want to use an ini file then a setup like below should do the trick.

Ini file:
 Quote:

[group1]
printers=printer1,printer2
default=printer2
[group2]
printers=printer1,printer3
default=printer3


Example code using the ini file above:
 Code:
Break on

$inifile = "Path and name of ini file goes here"

If InGroup("group1")
	$printers = ReadProfileString($inifile, "Group1", "Printers")
	$printers = Split($printers, ",")
	$default = ReadProfileString($inifile, "Group1", "Default")
	For Each $printer in $printers
		$rc = AddPrinterConnection($printer)
		If $printer = $default
			$rc = SetDefaultPrinter($printer)
		EndIf
	Next
EndIf


Edited by Mart (2010-01-04 11:55 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.