Tuesday, July 31, 2012

Set Default Printer.vbs

strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colPrinters = objWMIService.ExecQuery("Select * From Win32_Printer") For Each objPrinter in colPrinters rem MsgBox objPrinter.Name If not InStr(1,objPrinter.Name, "pdf",vbTextCompare) = 0 Then rem MsgBox "Default Printer set" objPrinter.SetDefaultPrinter end if Next

No comments:

Post a Comment