Hi,
I would like to select all printers installed on the computer that contains a specific name (for example: select all printers with "Microsoft" in the name of the printer).
I used the following code, but doesn't work:
I would like to select all printers installed on the computer that contains a specific name (for example: select all printers with "Microsoft" in the name of the printer).
I used the following code, but doesn't work:
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'Microsoft*'")
For Each objPrinter in colInstalledPrinters
Wscript.Echo "Name: " & objPrinter.Name
'Wscript.Echo "Location: " & objPrinter.Location
'Wscript.Echo "Default: " & objPrinter.Default
Next