Help a noob write a batch file to restart print spooler (and address admin issue)

I have never written a batch file before or done any programming; so I am using this opportunity to hopefully address an ongoing issue we are running into with the new PCs at my company while simultaneously getting my feet wet in this area.

We have a bunch of new PCs running Windows 8. HP has not yet released updated drivers yet. Therefore, some of our printers will sporadically stop working for no apparent reason. We have found that restarting the Spooler usually resolves the issue (at least until it happens again...)

I found a batch file online that does this (see below); and, I think I understand more or less how it works. However, when I try to run it, the system says "System error 5 has occurred. Access is denied." I'm assuming this happens because I do not have admin privileges (for the record, yes, the system admin knows I'm playing around with this writing this batch file -- I know I could get him to do it, but I'm trying to figure it out w/o bugging him!) However, if I open the Services (Local) screen, I have permission to right click on the Spooler and manually command it to Stop or Restart. So, is there a way to create a batch file that does this w/o requiring admin privileges?

Batch file:

NET stop spooler
NET start spooler

Also, is there a better way to write this app (aside from removing the echo and pause commands, which I'm only including as a learning tool/to see what's happening.) Any tips/insight would be greatly appreciated. Thanks!

It is probably a credentials issue.  This is probably best asked on Technet,
Cat herder
Windows Insider MVP
MVP-Windows and Devices for IT

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.


Question Info

Last updated May 5, 2021 Views 9,440 Applies to: