Checking to see if the pri9nter exists before installing it is a matter of taste. I never do it. At work we have a logon script that deletes all network printers and installs network printers based upon group membership. See below on how to delete all network printers.

There are several UDF's in the UDF section that let you send an e-mail. Writing to a log file is also an option. Writeline is your friend when writing to a log file. Personally I like to use BlatMailer(). Not listed in the UDF section but there are some examples on the board. Today it is a national holiday here but I'll VPN to work and get a copy of the UDF send to my home e-mail or FTP it.

Standby......

 Code:
Break on

;======== Delete all network printers ========
;Delete all mapped network printers
$key = "HKEY_CURRENT_USER\Printers\Connections"
$printers = ArrayEnumKey($key)
For Each $printer in $printers
	$rc = DelKey($key + "\" + $printer)
Next

;=-=-=-=-=- Do not modify anything below this line =-=-=-=-=-
;=-=-=-=-=- below is a UDF and they comes ready made =-=-=-=-=-

;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


Edited by Mart (2008-05-01 11:13 AM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.