Batch to start/stop services

W

wbyeats74

Hi guys, I'm trying to make a batch file to stop and start multiple
services on my pc.

When I run it I get an error 5 access denied error for each process I
try to start.
Why? I'm admin of my pc and If I try to manually stop it in the
services window I can successfully stop it.
I just cannot when I try to stop them in the batch.
Is there any solution?

Thanks a lot in advance

mario
 
P

Pegasus \(MVP\)

Hi guys, I'm trying to make a batch file to stop and start multiple
services on my pc.

When I run it I get an error 5 access denied error for each process I
try to start.
Why? I'm admin of my pc and If I try to manually stop it in the
services window I can successfully stop it.
I just cannot when I try to stop them in the batch.
Is there any solution?

Thanks a lot in advance

mario

Let's have a look at your batch file.
 
W

wbyeats74

Let's have a look at your batch file.

Well, that's not really complicated ...

it contains:

net stop "Servicename1"
net stop "Servicename2"
net stop "Servicename3"

That's it.
I've also tested it with just Servicename1 but it doesn't work anyway.

mario
 
P

Pegasus \(MVP\)

Well, that's not really complicated ...

it contains:

net stop "Servicename1"
net stop "Servicename2"
net stop "Servicename3"

That's it.
I've also tested it with just Servicename1 but it doesn't work anyway.

mario

OK. And what happens when you type the command at a Command Prompt?

net stop w32time{Enter}

(Please note: A "Command Prompt" is NOT the same thing as the Start/Run
box!)
 
W

wbyeats74

OK. And what happens when you type the command at a Command Prompt?

net stop w32time{Enter}

(Please note: A "Command Prompt" is NOT the same thing as the Start/Run
box!)

If I try to net stop w32time it works.
But if I try to net stop my service it says Error 5, access denied.
The problem is that I can stop this service via the Services windows
panel, but not via command.

So it's not related to every services, but just this particoular one

mario
 
P

Pegasus \(MVP\)

OK. And what happens when you type the command at a Command Prompt?

net stop w32time{Enter}

(Please note: A "Command Prompt" is NOT the same thing as the Start/Run
box!)

If I try to net stop w32time it works.
But if I try to net stop my service it says Error 5, access denied.
The problem is that I can stop this service via the Services windows
panel, but not via command.

So it's not related to every services, but just this particoular one

mario

=============

.. . . and it's not related to batch files either!

I haven't come across this one before. Perhaps sc.exe will do the trick:
sc start w32time
sc stop w32time

I also recommend that you look more closely at the account under the
service's "Log on" tab. In particular you should compare the settings of
your own service with those of the w32time service.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top