I've fiddled around with your code a bit and ended up with this (untested):
 Code:
Dim $sDOMAIN,$sSpooler,$sDone,$iDefaultDone
$sDOMAIN="westcare"
$sSpooler="\\wcps1\"
$sDone=@CRLF
$iDefaultDone=0

;set index to 0 for looping through groups
$iIndex = 0

;get first group name
$sGroup=EnumGroup($Index)
While Len($sGroup) AND @ERROR=0
	;if group name starts with print- or printd-
	If (InStr($sGroup,$sDOMAIN+"\print-")=1) OR (InStr($sGroup,$sDOMAIN+"\printd-")=1)
		$sPrinter=SubStr($sGroup,InStr($sGroup,"-")+1) ; Note, this won't work if you have "-" in the domain name
		If InStr($sDone,@CRLF+$sPrinter+@CRLF)
			; Printer has already been added - no point in doing it again.
		Else
			; Add printer and make sure it’s successful
			If AddPrinterConnection($sSpooler+$sPrinter)
				; Display error message and text
				"Error Adding Printer: "+$sPrinter+@CRLF
				"Error: "+@SERROR+@CRLF
			Else
				"Added printer: "+$sPrinter+@CRLF	; Display success message
				$sDone=$sDone+$sPrinter+@CRLF		; Record success
			EndIf
		EndIf
		; If printer has been added OK AND is default AND a default has not been set already...
		If InStr($sDone,@CRLF+$sPrinter+@CRLF) AND InStr($sGroup,$sDOMAIN+"\printd-")=1 AND $iDefaultDone=0
			If SetDefaultPrinter($s$sPrinter)
				; Display error message and text
				"Error Setting Default Printer: "+$sPrinter+@CRLF
				"Error: "+@SERROR+@CRLF
			Else
				"Set default to: "+$sPrinter+@CRLF	; Display success message.	
				$iDefaultDone=1
			EndIf
		EndIf
	EndIf
	$iIndex=$iIndex+1		 ;increase the loop counter by 1
	$sGroup=EnumGroup($iIndex)	 ;get next group name

; loop until end of groups list
Loop


So what's changed...
  • Constants like the domain and print server are abstracted to variables.
    This makes things easy to change and makes errors easier to trap and fix.
  • The code to add printers has been collapsed into one segment.
    You should never write the same code twice - if you cannot coded it inline once then wrap it up in a function and re-use it. This way if you want to make a change to the way that you map the printer or handle the errors you only need to change the function once.
  • Successful printer mappings are stored in the $sDone variable, so we don't try to add the same printer again. If you are adding printers elsewhere (such as via the INI file) then you should add them to this list on success. Alternatively you can use Mart's PriMapState() example.
  • Setting the default printer is only done once - you can't have more than one default. Again, if you might set the default elsewhere then set the $iDefaultDone flag when you do it.
  • Printer name pulled from group name and reused. I was running out of SubStr() tiles in my KiXtart Scrabble bag.
  • Buggy use of index variables sorted. You ARE using SetOption(Explicit,"ON") in your code, aren't you?