So far the only thing that works is this, but it has to be run locally, even then it seems to take forever to gather up the names of the printers on the server before it queues the test print job.
$p= Get-WmiObject win32_printer
foreach ($i in $p){
If ($i.name -eq "print222"){
$i.printtestpage()
BREAK
}
}
Does anyone have an way to send a test page to a printer on a remote print server, that doesn’t take a long time to complete the task? I would’ve thought this to be a pretty straight forward thing to do, but apparently not so much.
I was able to (somehow) figure this out. I had to play around with the cmd a bit to see what did and didn’t work, then build a cmd from there.
A little background:
My first attempts were either not working and would report that they did (see previous post with cmd examples), or they would take so long to run I thought the session was hung. I found if I ran the following cmd, it did work, but it had taken about 2 minutes to run as reported by Measure-Command:
Anything over 5 seconds is, in my opinion, too long. Then I found I can use the “-AsJob” flag and dramatically improve the speed of the cmd. The following is the winner for this problem as it only takes 2 seconds to send a test page to a remote print device hosted on a print server somewhere in the world.
So, if anyone out there is looking to be able to send a test page to a remote print device, setup the vars for the printer server name ($s) and the name of the printer ($p), then use the above cmd.