Posted By

goo on 01/07/13


Tagged

default change printer Impresora


Versions (?)

[VBS] Change Default Printer


 / Published in: Visual Basic
 

Change default printer with vbs script

  1. strComputer = "."
  2. printer = "PRINTER_NAME"
  3.  
  4. Set objWMIService = GetObject("winmgmts:" _
  5. & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  6.  
  7. Set colInstalledPrinters = objWMIService.ExecQuery _
  8. ("Select * from Win32_Printer Where Name = '" & printer & "'")
  9.  
  10. For Each objPrinter in colInstalledPrinters
  11. objPrinter.SetDefaultPrinter()
  12. msgbox "Printer Changed to:" & Chr(13) & Chr(13)_
  13. & printer, vbokonly + vbinformation, "Printers"
  14. Next

Report this snippet  

You need to login to post a comment.