批量删除网络打印机的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 "删除网络打印机完成"

posted @ 2014-09-05 16:06  daniel肥杰  阅读(1352)  评论(0编辑  收藏  举报