Export (0) Print
Expand All

PrintTestPage method of the Win32_Printer class

The PrintTestPage WMI class method prints a test page.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.

Syntax


uint32 PrintTestPage();

Parameters

This method has no parameters.

Return value

Return codeDescription
0

Success

5

Access Denied

 

Examples

The following PowerShell code sample prints a test page.



# Get printer objects from  WMI
$printers=Get-WmiObject Win32_Printer
"{0} Printers defined on this system" -f $printers.count

# Get a specific printer
$printer = $printers | where {$_.name -eq "\\smallguy\HP LaserJet 5M"}

# Display info
"Printer share name: {0}\{1}" -f $printer.servername, $printer.sharename
"Printer Port      : {0}    " -f $printer.PortName
  
# Print a test page
$printer.PrintTestPage()


Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

Root\CIMV2

MOF

Win32_Printer.mof

DLL

CIMWin32.dll

See also

Computer System Hardware Classes
Win32_Printer

 

 

Show:
© 2015 Microsoft