Batch file to clear print queues on a remote SBS 2003 server

I'm looking for a way to allow workstation users to clear the print queues on a remote SBS 2003 server.

The users are admins of their local workstations, but NOT admins for the server.

This batch file seems to work at stopping & starting the print service on the server:

sc \\sbserver stop spooler
ping -n 5
sc \\sbserver start spooler

... but I cannot seem to find the right command to place in the middle to delete all the files in the PRINTERS folder.

I have tried:

del \\sbserver\%systemroot%\system32\spool\printers\*.*

... but I get "The network name cannot be found".

Any help is appreciated!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Lee W, MVPTechnology and Business Process AdvisorCommented:
Your Del command won't work as you already know - %systemroot% typically expands to c:\Windows - so saying
del \\sbserver\%systemroot%\system32\spool\printers\*.*
actually means
del \\sbserver\c:\windows\system32\spool\printers\*.*
And you can't use a colon in a UNC path.

*IF* the account running the batch file has permissions to the folder, use:
del "\\sbserver\c$\windows\system32\spool\printers\*.*"

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
Lee W, MVPTechnology and Business Process AdvisorCommented:
You could create a scheduled task on a machine and save an administrator account and password to it and then let a non-administrator kick off the task.  I would also recommend NOT pinging google - instead ping the loopback address -
cricketmanAuthor Commented:
Did just what I wanted - thanks!!!
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 Server 2003

From novice to tech pro — start learning today.