Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Cancel a print job from the shell

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 07-19-2007   #1 (permalink)
NormyB
Guest


 

Cancel a print job from the shell

Hello all,

I am stuck. I want to be able to use PS to cancel a specific printjob.
I know the printer name and the JobID. How can I pull this off? Is
there a powershell way to say " Cancel JobID 123 on Server1" ??


Any suggestions would be greatly appreciated.

Thanks,

Norm


My System SpecsSystem Spec
Old 07-19-2007   #2 (permalink)
Marco Shaw
Guest


 

Re: Cancel a print job from the shell

NormyB wrote:
> Hello all,
>
> I am stuck. I want to be able to use PS to cancel a specific printjob.
> I know the printer name and the JobID. How can I pull this off? Is
> there a powershell way to say " Cancel JobID 123 on Server1" ??
>
>
> Any suggestions would be greatly appreciated.
>
> Thanks,
>
> Norm
>


I checked WMI and also a DLL from the resource kit, and they can only
purge *all* jobs from what I can tell.

You can however use plain old 'net print' from PowerShell though:
http://www.windowsitpro.com/Articles...533/14533.html

Marco
My System SpecsSystem Spec
Old 07-19-2007   #3 (permalink)
Kiron
Guest


 

Re: Cancel a print job from the shell

Try PrintSystemJobInfo Class' Cancel Method.
You may need to load its assembly, System.Printing (system.printing.dll)

http://msdn2.microsoft.com/en-us/lib...emjobinfo.aspx
http://msdn2.microsoft.com/en-us/lib...o_methods.aspx

--
Kiron

My System SpecsSystem Spec
Old 07-20-2007   #4 (permalink)
NormyB
Guest


 

Re: Cancel a print job from the shell

On Jul 19, 8:14 pm, "Kiron" <Ki...@HighPlainsDrifter.com> wrote:
> Try PrintSystemJobInfo Class' Cancel Method.
> You may need to load its assembly, System.Printing (system.printing.dll)
>
> http://msdn2.microsoft.com/en-us/lib...g.printsystemj...
>
> --
> Kiron


Thanks Marco

I did find Wni32_PrintJob which has a method CancelAllJobs() but I'm
not sure how to use it, or more accuratly stated, I dont know how to
use it to tell a specfic printer on a print share to cancell all
jobs.


Thanks again,

Norm

My System SpecsSystem Spec
Old 07-21-2007   #5 (permalink)
dreeschkind
Guest


 

Re: Cancel a print job from the shell

Try this:

Get-WmiObject Win32_Printer -computerName HAL9000 | Where {$_.Name -eq
"Microsoft XPS Document Writer"} | ForEach { $_.CancelAllJobs() }

--
greetings
dreeschkind

"NormyB" wrote:

> On Jul 19, 8:14 pm, "Kiron" <Ki...@HighPlainsDrifter.com> wrote:
> > Try PrintSystemJobInfo Class' Cancel Method.
> > You may need to load its assembly, System.Printing (system.printing.dll)
> >
> > http://msdn2.microsoft.com/en-us/lib...g.printsystemj...
> >
> > --
> > Kiron

>
> Thanks Marco
>
> I did find Wni32_PrintJob which has a method CancelAllJobs() but I'm
> not sure how to use it, or more accuratly stated, I dont know how to
> use it to tell a specfic printer on a print share to cancell all
> jobs.
>
>
> Thanks again,
>
> Norm
>
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't cancel print job Phil Vista General 5 3 Weeks Ago 10:48 PM
PLEASE CANCEL THIS EMAIL A. JOYCE THIELE Vista mail 1 11-17-2007 02:59 PM
Can't cancel color print stesdahl Vista print fax & scan 1 11-04-2007 08:11 PM
Executing Power Shell Scripts from Windows Shell Mugunth PowerShell 3 05-02-2007 10:37 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008