CancelAllJobs method of the Win32_Printer class
The CancelAllJobs WMI class method removes all jobs, including the one currently printing from the queue.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 CancelAllJobs();
Parameters
This method has no parameters.
Return value
Returns one of the values listed in the following list, or any other value to indicate an error. For additional error codes, see WMI Error Constants or WbemErrorEnum. For general HRESULT values, see System Error Codes.
-
0
-
Success
-
5
-
Access Denied
Examples
The following VBScript sample deletes all the print jobs for a printer named HP QuietJet.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where Name = 'HP QuietJet'")
For Each objPrinter in colInstalledPrinters
objPrinter.CancelAllJobs()
Next
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Namespace |
Root\CIMV2 |
MOF |
|
DLL |
|