Windows Vista Forums

Cancel a print job from the shell

  1. #1


    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

  2. #2


    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

  3. #3


    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

  4. #4


    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

  5. #5


    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

Cancel a print job from the shell

Similar Threads
Thread Forum
Can parent shell monitor run/crash status of Child shell/exe ?
I am running automated daily-regression tests - various configs. I have written powershell script invoking EXEs . But, if any Exe...
PowerShell
cancel
From: "James Parrott" <Devilsgottago@xxxxxx> Subject: i cannot get my email Date: January-10-09 3:19 PM i don't know what it is but on my other...
Vista mail
Can't cancel print job
Hi, Why is it I can't cancel a print job without waiting 15-20 minutes? When click on the print job and select "Cancel" it shows "Deleting -...
Vista General
Cancel diskcheck
Is it possible to cancel a boot-time disk check? This is what I've tried: - Ctrl-C or Ctrl-break didn't work - Booting in safe mode hangs on...
Vista General
Can't cancel color print
Help! I've got an HP 6110 officject running Vista Home Premium. I am not able to print in draft mode or black and white or grayscale. I set the...
Vista print fax & scan
Executing Power Shell Scripts from Windows Shell
Typing powershell "D:\PowerShell Examples\TempScript.ps1" on the cmd prompt, gives an error that, The term 'D:\PowerShell' is not recognized as a...
PowerShell
Shell extension - how do I disable the preview pane for my shell e
I have a shell extension we've used for years on Win2k, XP, 2k3 server. Porting this to Vista, testing using build 5270, using .net 2005 VS C++. ...
Aero