There are occasions when you may wish to print a test page on a printer; for example, after you change the toner or printer ink on a physical printer or after changing the print driver (as shown in the Changing printer drivers recipe). In those cases, the test page helps you to ensure that the printer is working properly.
This recipe uses the PSRV
print server that you set up in the Installing and sharing printers recipe.
$Printers = Get-CimInstance -ClassName Win32_Printer
'{0} Printers defined on this system' -f $Printers.Count
$Printer = $Printers | Where-Object Name -eq "SalesPrinter1"
$Printer | Format-Table -AutoSize
Invoke-CimMethod -InputObject $Printer -MethodName PrintTestPage
In step 1, you used Get-CimInstance
to return all the printers defined on this system. There's no output from this step.
In step 2, you displayed the total printers defined, which looks like this:
In step 3, you got the printer object that corresponds to the sales group LaserJet printer, which generates no output. In step 4, you displayed the details of this printer, which looks like this:
In step 5, you invoked the PrintTestPage
method on the sales group printer (SalesPrinter1
) to generate a test page on the printer. Using the printer MMC snap-in, generating a test page looks like this:
18.218.151.44