You will need to read up on exactly what the PrimaryGroupID is.

http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=006263

code:
$WS = GetObject("WinNT://" + @domain + "/" + @wksta + "$$, user")
if @error
? @serror
else
for each $grp In $WS.Groups
$GrpName = $grp.Name
if left($GrpName,8) = "Printer_"
$printer = substr($GrpName,9)
$printer = join(split($printer,"_"),"\")

if not PriMapState("\\" + $printer)
? "Status - Printer not connected "+$printer
$S=AddPrinterConnection("\\" + $printer)
; $Returncode=AddPrinterConnection("\\" + $printer)
? "Status - Printer added "+$printer
? @serror
?
endif
endif
next

;set default printer

$PrimaryGrpID = $WS.Get("PrimaryGroupID")
;This returns the RID (Relative Identifier) of the Group.
;This is NOT a group name
;You need code here to convert the RID to the group name
endif

_________________________
Home page: http://www.kixhelp.com/hb/