"SC stop spooler" Access denied

Hello Tom's, long time lurker first time poster.

Systems Admin for my company, writing a batch file to restart the spooler service. "SC \\hostname stop spooler" works fine but when I run SC Stop spooler on the system itself it gives me the error:

C:\Users\mydomainname.mydomain\Desktop>sc stop spooler
[SC] OpenService FAILED 5:

Access is denied.


I'm logged in as an admin, like I said it works fine remotely just not when on the local system. and I need to do this on a lot of systems so changing the hostname in the .bat each time is not an option.

Any suggestions would be appreciated!!

(all win 7 pro, SP1, 2008 AD)
4 answers Last reply
More about stop spooler access denied
  1. Just a little more info


    SERVICE_NAME: spooler
    TYPE : 110 WIN32_OWN_PROCESS (interactive)
    STATE : 4 RUNNING
    (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
    WIN32_EXIT_CODE : 0 (0x0)
    SERVICE_EXIT_CODE : 0 (0x0)
    CHECKPOINT : 0x0
    WAIT_HINT : 0x0
  2. When run sc \\Myhostname stop spooler from a remote machine it works fine!


    SERVICE_NAME: spooler
    TYPE : 110 WIN32_OWN_PROCESS (interactive)
    STATE : 3 STOP_PENDING
    (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
    WIN32_EXIT_CODE : 0 (0x0)
    SERVICE_EXIT_CODE : 0 (0x0)
    CHECKPOINT : 0x0
    WAIT_HINT : 0x0

    What is going on?!
  3. Sorry I was being an idiot got the answer from technet

    "You need to make sure you're running the command prompt as Administrator. Type cmd in the start menu, then right-click it and hit "Run as Administrator" -- otherwise it uses your standard user token, for security purposes."

    All day I was writing batch files for remote machines and I forgot about this.
  4. Sbrigham said:
    Sorry I was being an idiot got the answer from technet

    "You need to make sure you're running the command prompt as Administrator. Type cmd in the start menu, then right-click it and hit "Run as Administrator" -- otherwise it uses your standard user token, for security purposes."

    All day I was writing batch files for remote machines and I forgot about this.



    Thanks Sbrigham, your information helped us at ontime.
Ask a new question

Read More

Hostname Systems Windows 7