Cancel all printer jobs

G

gokcey

Hi,
My computer's operating system is Windows 2000. I need to cancel al
jobs on
printer. For this reason I have written a script code below:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
"{impersonationLevel=imper
sonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery _
("Select * from Win32_PrinterConfiguration")
For Each objPrinter in colInstalledPrinters
If objPrinter.Name = "Xerox DocuPrint N2125" Then
objPrinter.CancelAllJobs()
End If
Wscript.Echo "Name: " & objPrinter.Name
Next

However, When I run this script, I get an error like below:
Microsoft VBScript runtime error: Object doesn't support thi
property
or method: 'objPrinter.CancelAllJobs'

Is this because the operating system is Windows 2000.
What can I do to cancel all jobs in my printer using code?
Thanks in advance


-
gokce
 
F

Felix Maxa [MSFT]

Hi, you need to use Win32_Printer, not Win32_PrinterConfiguration

--
Felix Maxa
Microsoft Printing, Imaging and Fax Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top