0

I want to add around 40 printers to my machine in order to test the performance of the application which uses WMI for printer functions.

What I want is a way to add dummy/fake printers (Not only 1 printer but more than 1 printers) through some sort of script or programming.

Please note that I have gone through most of the options to add virtual Printer to the system but none of them says how to add Printers. Reason behind asking it to be done by script or programming is that, if I have one, I can test it on multiple machines.

BSMP
  • 4,596
  • 8
  • 33
  • 44
atp9
  • 890
  • 1
  • 11
  • 23

1 Answers1

0

Unfortunately Windows 7 does not feature the really nice Add-Printer Function Powershell introduced in Windows 8.1 but you can do this via WMI.

In VBScript some example code would look like this:

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_

For i = 1 to 40
    name = "Testprinter" & i
    objPrinter.DeviceID = name
    objPrinter.Caption = name
    objPrinter.DriverName = "Microsoft XPS Document Writer"
    objPrinter.PortName = "XPSPort:"
    objPrinter.Put_
Next

This will Create 40 Printers with the name "Testprinter" which are copies of Microsofts XPS Document Writer basically.

Please note that in the "Device and Printers" View Windows 7 would group them all together due to them having the same port, but I doubt that would influence your testing.

Community
  • 1
  • 1
Syberdoor
  • 2,521
  • 1
  • 11
  • 14