Export (0) Print
Expand All

Win32_PrintJob class

The Win32_PrintJob WMI class represents a print job generated by a Windows application. Any unit of work generated by the print command of an application that is running on a computer running on a Windows operating system is a descendent or member of this class.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties are listed in alphabetic order, not MOF order.

Syntax

class Win32_PrintJob : CIM_Job
{
  string   Caption;
  string   Color;
  string   DataType;
  string   Description;
  string   Document;
  string   DriverName;
  datetime ElapsedTime;
  string   HostPrintQueue;
  datetime InstallDate;
  uint32   JobId;
  string   JobStatus;
  string   Name;
  string   Notify;
  string   Owner;
  uint32   PagesPrinted;
  uint32   PaperLength;
  string   PaperSize;
  uint32   PaperWidth;
  string   Parameters;
  string   PrintProcessor;
  uint32   Priority;
  uint32   Size;
  datetime StartTime;
  string   Status;
  uint32   StatusMask;
  datetime TimeSubmitted;
  uint32   TotalPages;
  datetime UntilTime;
};

Members

The Win32_PrintJob class has these types of members:

Methods

The Win32_PrintJob class has these methods.

MethodDescription
Pause

Pauses a print job.

Resume

Continues a print job.

 

Properties

The Win32_PrintJob class has these properties.

Caption
Data type: string
Access type: Read-only
Qualifiers: MaxLen (64)

Short description of the object—a one-line string. This property is inherited from CIM_ManagedSystemElement.

Color
Data type: string
Access type: Read-only

String that indicates whether the document is printed in color or monochrome. Some color printers have the capability to print using true black instead of a combination of yellow, cyan, and magenta. True black usually creates darker and sharper text for documents. This option is only useful for color printers that support true black printing.

Windows Server 2003:  This property is not available.

The values are:

"Color"
"Monochrome"
DataType
Data type: string
Access type: Read-only

Format of the data for this print job. This instructs the printer driver to translate the data (generic text, PostScript, or PCL) before printing, or print in a raw format (for graphics and pictures).

Example: "TEXT"

Description
Data type: string
Access type: Read-only

Description of the object. This property is inherited from CIM_ManagedSystemElement.

Document
Data type: string
Access type: Read-only

Name of the print job. The user sees this name when viewing documents that are waiting to be printed.

Example: "Microsoft Word - Review.doc"

DriverName
Data type: string
Access type: Read-only

Name of the printer driver used for the print job.

ElapsedTime
Data type: datetime
Access type: Read-only

Length of time that the job has been executing. This property is inherited from CIM_Job.

HostPrintQueue
Data type: string
Access type: Read-only

Name of the computer on which the print job is created.

InstallDate
Data type: datetime
Access type: Read-only

Date and time the object is installed. This property does not need a value to indicate that the object is installed. This property is inherited from CIM_ManagedSystemElement.

JobId
Data type: uint32
Access type: Read-only

Identifier number of the job. It is used by other methods as a handle to a job spooling to the printer.

JobStatus
Data type: string
Access type: Read-only

Free-form string that represents the job status. This property is inherited from CIM_Job.

Name
Data type: string
Access type: Read-only
Qualifiers: Key

Name of the printer to which the print job is being spooled followed by a comma and then the number of the job. For example, PrinterName, JobNumber. This property is inherited from CIM_ManagedSystemElement. This value matches the value in the Name property of the associated Win32_Printer instance.

Notify
Data type: string
Access type: Read-only

User is to be notified when the job either completes or fails. This property is inherited from CIM_Job.

Owner
Data type: string
Access type: Read-only

User that submitted the job. This property is inherited from CIM_Job.

PagesPrinted
Data type: uint32
Access type: Read-only

Number of pages that are printed. This value may be 0 (zero) if the print job does not contain page-delimiting information.

PaperLength
Data type: uint32
Access type: Read-only
Qualifiers: Units (Tenths of a millimeter.)

Length of the paper.

Example: 2794

PaperSize
Data type: string
Access type: Read-only

Size of the paper used to print the job. The value is one of the possible paper sizes for the printer specified in the PaperSizesSupported property of Win32_Printer class.

Windows Server 2003:  This property is not available.

PaperWidth
Data type: uint32
Access type: Read-only
Qualifiers: Units (Tenths of a millimeter.)

Width of the paper.

Example: 2159

Parameters
Data type: string
Access type: Read-only

Optional parameters to send to the print processor. For more information, see the PrintProcessor property.

PrintProcessor
Data type: string
Access type: Read-only

Print processor service used to process the print job. A printer processor works in conjunction with the printer driver to provide additional translation of printer data for the printer, and can also be used to provide special options, such as a title page for the job.

Priority
Data type: uint32
Access type: Read-only

Urgency or importance of job execution. This property is inherited from CIM_Job.

Size
Data type: uint32
Access type: Read-only
Qualifiers: Units (Bytes)

Size of the print job.

StartTime
Data type: datetime
Access type: Read-only

Date and time that the job begins. This property is inherited from CIM_Job.

Status
Data type: string
Access type: Read-only
Qualifiers: MaxLen (10)

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states. This property is inherited from CIM_ManagedSystemElement.

The values are:

"OK"
"Error"
"Degraded"
"Unknown"
"Pred Fail"
"Starting"
"Stopping"
"Service"
"Stressed"
"NonRecover"
"No Contact"
"Lost Comm"
StatusMask
Data type: uint32
Access type: Read-only

Bitmap of the possible statuses that relate to this print job.

ValueMeaning
1 (0x1)

Paused

2 (0x2)

Error

4 (0x4)

Deleting

8 (0x8)

Spooling

16 (0x10)

Printing

32 (0x20)

Offline

64 (0x40)

Paperout

128 (0x80)

Printed

256 (0x100)

Deleted

512 (0x200)

Blocked_DevQ

1024 (0x400)

User_Intervention_Req

2048 (0x800)

Restart

 

TimeSubmitted
Data type: datetime
Access type: Read-only

Time that the job is submitted. This property is inherited from CIM_Job.

TotalPages
Data type: uint32
Access type: Read-only

Number of pages required to complete the job. This value may be 0 (zero) if the print job does not contain page-delimiting information.

UntilTime
Data type: datetime
Access type: Read-only

Time when the job is invalid or should be stopped. This property is inherited from CIM_Job.

Remarks

The Win32_PrintJob class is derived from CIM_Job.

Examples

The following VBScript code sample describes how to retrieve printer jobs stats from instances of Win32_PrintJob.


Set PrintJobSet = GetObject("winmgmts:").InstancesOf ("Win32_PrintJob")

If (PrintJobSet.Count = 0) Then WScript.Echo "No print jobs!"
for each PrintJob in PrintJobSet
 WScript.Echo PrintJob.Name
 WScript.Echo PrintJob.JobId
 WScript.Echo PrintJob.Status
 WScript.Echo PrintJob.TotalPages
 Wscript.Echo ""
next

The following Perl code sample describes how to retrieve printer jobs stats from instances of Win32_PrintJob.


use strict;
use Win32::OLE;

close (STDERR);

my ($PrintJobset, $PrintJob);
eval {$PrintJobset = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate}")->
 InstancesOf ("Win32_PrintJob") };
if (!$@ && defined $PrintJobset)
{
 if ($PrintJobset->{Count} == 0 ) 
 {
  print "\nNo print jobs!\n";
 }

 foreach $PrintJob (in $PrintJobset)
 {
  print $PrintJob->{Name} , "\n";
  print $PrintJob->{JobId} , "\n";
  print $PrintJob->{Status} , "\n";
  print $PrintJob->{TotalPages} , "\n";
 }
}
else
{
 print Win32::OLE->LastError, "\n";
}


Requirements

Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

Namespace

\root\CIMV2

MOF

CIMWin32.mof

DLL

CIMWin32.dll

See also

Computer System Hardware Classes

 

 

Show:
© 2014 Microsoft