I finally got my new print server online and could do some testing of the below script. It removes and adds the printers without issues, but sometimes has issues with the default printer. It might set the default printer correctly, but sometimes it doesn't set a default at all or selects a different printer as the default (it almost seems random).

Just to recap, all printer names are the same on both the old and new print servers (just a new server name).

Any suggestions would be appreciated.


 Code:

$oldPrinters = 'Print1', 'Print2', 'Print3', 'Print4', 'Print5', 'Print6'
$defaultprinter = GetDefaultPrinter()
$OldSvr = '\\OldServer\'
$NewSvr = '\\NewServer\'

For Each $Printer in $oldPrinters  ; enumerate list of all printer names
  If PriMapState($OldSvr + $Printer) ; is it mapped to old server?
    AddPrinterConnection($NewSvr + $Printer)  ; connect to new server
 	if not @error
	    DelPrinterConnection($OldSvr + $Printer)  ; disconnect from old
	EndIf	
  EndIf
	If $defaultprinter = ($OldSvr + $Printer)  ; select old default printer	
		$rc = SetDefaultPrinter($NewSvr + $Printer)
	EndIf
Next  ; check next printer

; GetDefaultPrinter UDF Function
function GetDefaultPrinter()
    $GetDefaultPrinter = join(split(readvalue("HKEY_USERS\"+@sid+"\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),',',1),'')
endfunction

; PriMapState UDF Function
function PriMapState($_Pri)
	if len(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices",$_Pri))
		if split(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0]=$_Pri
			$PriMapState=2
		else
			$PriMapState=1
		endif
	endif
endfunction



Thanks!

- RBB