|
The printers I am trying to delete are IPP Printers, so, I could delete them by querying the port instead of the name, so the name becomes irrelevant. I was thinking about doing something on the lines of this, but, it does not work. I might have it all wrong....
SetOption('Explicit','On') SetOption('NoVarsInStrings','On') 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
Dim $Key,$PrinterKeys,$Value,$Find,$Item,$Data $PrinterKeys=ArrayEnumKey('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers') $Value = "Port" $Find = "http://IPADDRESS/ipp" $Data = ReadValue($KEY,$VALUE) For Each $Key in $PrinterKeys If $Item = $FIND deltree($Key+$PrinterKeys) @error ? Next
|