[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Help me with a script to purge print queue then delete

Posted on 2009-04-02
3
Medium Priority
?
230 Views
Last Modified: 2012-06-21
whats wrong with this code? can someone help.
'call.2.purge.the.queue.then.delete
For Each objPrinter in colPrinters
    objPrinter.CancelAllJobs()
	objPrinter.Delete_
Next

Open in new window

0
Comment
Question by:dirkdigs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 27

Expert Comment

by:bluntTony
ID: 24052228
Aren't you missing the WMI query?
The below is the full version of what you have posted. Bear in mind that this will purge and delete EVERY printer found on the local machine.

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_Printer")
 
For Each objPrinter in colInstalledPrinters
    objPrinter.CancelAllJobs()
	objPrinter.Delete_
Next

Open in new window

0
 

Author Comment

by:dirkdigs
ID: 24054490
no i have that i just was posting the code that i think is wrong.
0
 
LVL 27

Accepted Solution

by:
bluntTony earned 1000 total points
ID: 24057984
Unfortunately that doesn't really show us much. Could you post the WMI query you have used, and the error message you are getting, and on what line this is occurring?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question