Function PrinterExist($PrinterName,optional $remotepc)
dim $service,$printer,$printers
$printerexist=0
if $remotepc=""
$remotepc='\\'+ @wksta
else
if not left($remotepc,2)="\\"
$remotepc='\\' + $remotepc
endif
endif
$Service=GetObject("winmgmts:{impersonationLevel=impersonate}!" + $remotepc +"\root\cimv2")
if not @error=0
exit @error
endif
$Printers=$service.execquery ('select * from Win32_Printer')
for each $printer in $printers
if ucase($printername)=ucase($printer.name)
$printerexist=1
endif
if left($printer.name,2)="\\"
if ucase($printername)=ucase(split(substr($printer.name,3),"\")[1] + " on " + split(substr($printer.name,3),"\")[0])
$printerexist=1
endif
endif
next
endfunction
dim $printer1
dim $printer2
$printer1 = "1" ;Deployed Printer Names
$printer2 = "2" ;Deployed Printer Names
if printerexist($printer1)
$cmd = 'rundll32 printui.dll,PrintUIEntry /dl /n "$printer1"'
endif
SHELL "$cmd"
if printerexist($printer2)
$cmd = 'rundll32 printui.dll,PrintUIEntry /dl /n "$printer2"'
endif
SHELL "$cmd"