Writing and scheduling a script to stop and then restart print spooler

I am running terminal services on a Windows 2000 server SP4.  Every so often the spooler stops allowing users the ability to delete jobs stuck in the print queue.  An administrator must log in, stop and then restart the spooler service to clear print jobs already deleted in the queue.

Can anyone tell me how to setup and schedule a script that will stop and restart the print spooler (as an administrator) every 4 to 6 hours?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Another expert has addressed this:


You'll want to set options in the Advanced button in the Schedule tab of your Scheduled Tasks
David LeeCommented:
Seems pretty simple.  Create a command file containing the following commands:

net stop spooler
net start spooler

Now create a scheduled job that runs the command file however often you want.  Set the job up under an account with admin rights.  Voila.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can even set the spooler to restart itself.  Its in the services properties.  What you really need to look at is the root of the problem.  Terminal services and Citrix can be very finicky about printing.  There are a few things you want to avoid.  Cheap printers, especially deskjet/inkjets.  Avoid auto printer creation whenver you can.  Also make sure all of your print drivers are current.  If you are printing to a bic copy/fax/scanner/email/espresso/food processor type machine, they often times you LPR.  I had this same problem and corrected it by installing print services from UNIX.
ortherAuthor Commented:
I actually tried both of these answers and they worked for me.  I finally just created a batch file to do the net stop spooler and net start spooler and scheduled them to run using Scheduler.  

Scheduler can be found by selecting Start, Programs, Accessories, System Tools, then Scheduled Tasks.  Follow the wizard and you should be good to go!

Thanks for your help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.