DelPrinterConnection is one of the functions that use the 'Printer Name' as opposed to the share name. If the printer name is different than the share name, try changing it to the printer name and see if that resolves the issue. Also, you don't need to enclose the function in an IF block if you're not going to use the condition for anything.

If you are only doing to suppress output, then you can also do it like so...

$nul = DELPRINTERCONNECTION ("\\192.168.1.1\PrinterName")


Edited by ShaneEP (2020-03-31 12:38 AM)