I thought this would be simple, but apparently not. I would like to send a test page to the default printer on the workstation I’m logged into. It should be the same test page I would get if I opened Printers and Scanners, opened the default printer, clicked “print test page”.
I’ve seen some examples where I can specify a printer name, but I would like the script to always go to what printer is configured as the workstation’s default, so that I can just run it to confirm where the print job shows up.
PS P:> (Get-CimInstance Win32_Printer -Filter “Default = TRUE”).PrintTestPage()
Method invocation failed because
[Microsoft.Management.Infrastructure.CimInstance] does not contain a
method named ‘PrintTestPage’.
At line:1 char:1
If the printer is installed for “all users” (i.e., it’s a “system level” device) it needs elevation. If the printer is installed for a specific user and that user runs the code, elevation isn’t needed.