I have moved all of our printers from our old print server cmi-25 to our new print server nsfcmi-4. We are currently still using the old server but i want to repoint everyone to the new server by just changing the servername on the current mapping. The share names are all still the same but the server has changed....

For example \\cmi-25\HP_3600 is now \\nsfcmi-4\HP_3600

I found this script below but i keep getting an error on line 17 saying undefined variable [$PriMapState]!
 Code:
If NOT @LOGONMODE
	Break On
Else
	Break Off
EndIf
Dim $SO
$SO=SetOption("Explicit", "ON")
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("WrapAtEOL", "ON")

Dim $OldServer, $NewServer, $ArrPtrs, $Ptr, $PtrMapState, $NUL
$OldServer = "\\cmi-25"
$NewServer = "\\nsfcmi-4"
$ArrPtrs = Split("Printer1,Printer2,Printer3",",")
For Each $Ptr In $ArrPtrs
	$PtrMapState = $PriMapState("\\" + $OldServer + "\" + $Ptr)
	If 0 < $PtrMapState			
		$NUL = AddPrinterConnection("\\" + $NewServer + "\" $Ptr)
		If NOT @ERROR AND 2 = $PtrMapState
			$NUL = SetDefaultPrinter("\\" + $NewServer + "\" $Ptr)
			If @ERROR
				? "Error setting default Printer Connection " + $Ptr
				? "Error " + @ERROR + ": " + @SERROR
			EndIf
		Else
			? "Error adding Printer Connection " + $Ptr
			? "Error " + @ERROR + ": " + @SERROR
		EndIf
		If NOT @ERROR
			$NUL = DelPrinterConnection($Ptr)
			If @ERROR
				? "Error deleting Printer Connection " + $Ptr
				? "Error " + @ERROR + ": " + @SERROR
			EndIf
		EndIf
	EndIf
Next


If anyone can suggest a fix or help that would be great... Thanks.....



Edited by Benny69 (2009-05-14 01:39 PM)
Edit Reason: Added Code Tags