Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ExecApp to Start/Stop Windows Service?
I have a finicky service that isnt always well behaved and I have to stop/start it. 

I'm trying to fix it with a button that calls ExecApp() but cant seem to get it working. I've tried a few things:
 - Calling "net" as the command with "start <service>" as the parameters
 - Calling "cmd" as the command with "/c net start <service>" as the parameters
 - Creating a batch file and calling that

None seem to work. 

Is there a proper way to do this?
The application that calls it would have to have admin privileges to do that, so it may be failing for that reason. Where you are invoking it from?
Dean Roddey
Explorans limites defectum
I tried two places to call it

1 - from the Admin interface, using the "Test" feature of the Global Action. It tests and exits without an error, but nothing happens to the service

2 - From the Amazon Echo. I can get the action to trigger, but nothing to the service.

Not sure if there is logging I can turn on to get more details, but I'm not sure why its failing. And I do agree about admin privileges - The app shell should have sufficient access, correct?
The app shell would only have sufficient privileges if you run it under a standard account probably. The default system service account might not have sufficient rights to affect other services.
Dean Roddey
Explorans limites defectum
Log the CQC service on with an account that has admin rights and then run it from an action.

you can stop and start in one line as well

net stop <service> && net start <service>

Use this a lot with CQC and other systems for manually restarting a service quickly.
Mykel Koblenz
Illawarra Smart Home
So I must be doing something basic wrong...

I've changed the CQC Services to run as a local admin account. Here's my global action:

    P2=/c net start "emby server"

If I run it within the admin tool or call it through the echo, it runs with no error, but the service doesnt start

Any idea? Znelbok - do you have a sample you can cut + paste here?
Does the application to run have to be quoted? So maybe:

"net start 'emby server'"

or something like that? So doubles for the overall thing and singles to handle the inner thing? Oh, wait, you said it worked ok when run from the foreground, so nevermind.

I'd change the last parameter to something that doesn't try to show the window, since it can't be shown when run from a service. Probably it just ignores that but it never hurts to try everything.
Dean Roddey
Explorans limites defectum

Possibly Related Threads...
Thread Author Replies Views Last Post
  Please report Windows 1803 compatibility RichardU 18 2,118 06-20-2018, 01:02 PM
Last Post: Dean Roddey
  Windows 10 1803 and TTS problem Ishmael 5 761 06-13-2018, 12:33 PM
Last Post: Dean Roddey
  Backup without Stopping Service RichardU 5 936 02-14-2018, 02:28 PM
Last Post: znelbok
  Windows 10 barely moving after upgrade. Deane Johnson 7 1,533 12-10-2017, 04:46 PM
Last Post: Dean Roddey
  Windows Server 2016 Essentials and CQC kblagron 2 939 11-30-2017, 11:00 PM
Last Post: kblagron
  ExecApp and .bat simon 15 3,490 11-16-2017, 06:27 PM
Last Post: Dean Roddey
  A word of warning regarding the Windows 10 Fall Creators Update Mark Stega 40 9,478 11-13-2017, 10:56 AM
Last Post: Dean Roddey
  Issues after fall Windows updates Ron Haley 3 1,325 10-24-2017, 06:35 PM
Last Post: Ron Haley
  rotate on windows 10 indygreg 3 1,649 08-09-2017, 07:26 AM
Last Post: Dean Roddey
Exclamation Windows as a service? Now, there’s an argument for Linux batwater 5 2,170 04-19-2017, 10:42 AM
Last Post: Dean Roddey

Forum Jump:

Users browsing this thread: 1 Guest(s)