批量删除网络打印机的2个方法

dos命令:

wmic path win32_printer where network=true delete

 

vbs脚本:

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer where network=true")

For Each objPrinter in colInstalledPrinters
  objPrinter.Delete_
Next

MsgBox "删除网络打印机完成"

你可能感兴趣的:(删除)