Return to Snippet

Revision: 61699
at January 7, 2013 23:58 by goo


Initial Code
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

Initial URL

                                

Initial Description
Change default printer with vbs script

Initial Title
[VBS] Change Default Printer

Initial Tags

                                

Initial Language
Visual Basic