Loading... 不说废话,直接上代码: ``` <pre class="prism-highlight prism-language-bash">on error resume next strComputer = "." Set FSO = CreateObject("Scripting.FileSystemObject") Set WshNETWORK = WScript.CreateObject("WScript.Network") Set WShell = WScript.CreateObject("WScript.Shell") Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer") For Each objPrinter in colInstalledPrinters if InStr(objPrinter.Name,"Canon 2900") then objPrinter.Delete_ End if if InStr(objPrinter.Name,"HP 1022") then objPrinter.Delete_ End if Next WShell.Run "cmd /k net use \\192.168.1.17\ipc$ userpassword /USER:username",0 WshNetwork.AddWindowsPrinterConnection "\\192.168.1.17\Samsung K2200 Series" WShell.Run "cmd /k rundll32 printui.dll,PrintUIEntry /y /n "&chr(34)&"\\192.168.1.17\Samsung K2200 Series"&chr(34)&"",0 WshNetwork.SetDefaultPrinter "\\192.168.1.17\Samsung K2200 Series" WScript.Echo "安装完成!" ``` Last modification:August 3, 2020 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 1 如果觉得我的文章对你有用,请随意赞赏