Below is an example of how to check the printers and remove what is no longer needed/available. This is basically how we do it in our logon script. The code below is a bit simplified and some company specific stuff has been removed. We have most settings and lists in INI files (nice way to easily make changes without having to dig into the code) and have extensive logging for all steps just to see what goes wrong when something goes wrong but for a proof of concept this is not really needed imho.

 Code:
Break on

;Set available printers
$printers = "\\server\printer01;\\server\printer02;\\server\printer03"
;Split printers on ;
$printers = Split($printers, ";")

;Get all installed network printers.
;Set the key that should be enumerated.
$key = "HKCU\Printers\Connections"
;Enumerate network printers key.
$oldprinters = ArrayEnumKey($key)

;Do stuff for each value
For Each $value in $oldprinters
	;Split the value on the comma.
	$value = Split($value, ",")
	;Put the value back together so that is shows the correct path to the printer.
	$oldprinter = "\\" + $value[2] + "\" + $value[3]
	If AScan($printers, $oldprinter) = -1
		? $oldprinter + " is no longer available and will be removed."
		$rc = DelPrinterConnection($oldprinter)
	Else
		? $oldprinter + " is still available."
	EndIf
Next
Sleep 5

;===== The code below is a UDF. It is ready for use and does not need to be changed. =====
;
;NAME          ArrayEnumKey
;
;ACTION        Creates an array of names of the subkeys contained in a registry key or subkey
;
;AUTHOR        Jens Meyer (sealeopard@usa.net)
;
;VERSION       1.2 (added error codes)
;              1.1
;
;DATE CREATED  2001/12/05
;
;DATE MODIFIED 2003/05/17
;
;KIXTART       4.12+
;
;SYNTAX        ARRAYENUMKEY($subkey)
;
;PARAMETERS    SUBKEY
;              Required string containing the key or subkey for which the subkeys will be enumerated
;
;RETURNS       Array containing the subkeys
;
;REMARKS       none
;
;DEPENDENCIES  none
;
;EXAMPLE       $retcode=arrayenumkey('HKEY_USERS')
;
;KIXTART BBS   http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000064
;
Function arrayenumkey($regsubkey)
	Dim $retcode, $subkeycounter, $currentsubkey, $subkeyarray
	
	If Not KeyExist($regsubkey)
		Exit 87
	EndIf
	
	$subkeycounter = 0
	Do
		$currentsubkey = EnumKey($regsubkey, $subkeycounter)
		If Not @ERROR
			ReDim preserve $subkeyarray[$subkeycounter]
			$subkeyarray[$subkeycounter] = $currentsubkey
			$subkeycounter = $subkeycounter + 1
		EndIf
	Until @ERROR
	
	$arrayenumkey = $subkeyarray
	Exit 0
EndFunction
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.