/ Published in: Visual Basic
Change default printer with vbs script
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
strComputer = "." printer = "PRINTER_NAME" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer Where Name = '" & printer & "'") For Each objPrinter in colInstalledPrinters objPrinter.SetDefaultPrinter() msgbox "Printer Changed to:" & Chr(13) & Chr(13)_ & printer, vbokonly + vbinformation, "Printers" Next