Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • October 17, 2017, 03:52 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: How to automatically restart a windows service?  (Read 350 times)

Magnatolia

  • Participant
  • Joined in 2016
  • *
  • default avatar
  • Posts: 4
    • View Profile
    • Donate to Member
How to automatically restart a windows service?
« on: September 22, 2017, 09:01 AM »
Hi guys,

Is it possible to use FARR to automatically restart the windows audio service? I'm having a problem where I have to restart the service after every 1 or 2 audio files and want to try and automate this a bit more.

Thanks!

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,485
    • View Profile
    • Donate to Member
Re: How to automatically restart a windows service?
« Reply #1 on: September 22, 2017, 03:36 PM »
First thing would be to find out how to make a batch file to restart the service, then you can easily invoke that batch file from FARR.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,676
    • View Profile
    • Donate to Member
Re: How to automatically restart a windows service?
« Reply #2 on: September 22, 2017, 08:45 PM »
Wouldn't it be better to discover why it's necessary to restart the service?

ie.
Is the program playing the files causing the service to screw up?
Try another program.

Is it a hardware or driver fault?
Check the Eventlog.

When the service screws up is it because it has stopped or it is running but still needs a restart?

Really need more info, it's easy to do a small PowerShell script to restart the service if its stopped but where it's still shown as running is probably going to be a little trickier since how would you know if it's being used or not?

EDIT: Can also restart the audio service using a command file, eg.

sc stop Audiosrv
ping 127.0.0.1 -n 10 >NUL
sc start Audiosrv

No checks, waits 10 seconds after stopping (ping command 10 times), then starts it.
Could add check for status with sc query Audiosrv but I think it'd be better to find out why it's necessary in the first place.
« Last Edit: September 22, 2017, 11:24 PM by 4wd »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,036
    • View Profile
    • Donate to Member
Re: How to automatically restart a windows service?
« Reply #3 on: September 23, 2017, 03:11 AM »
When the service screws up is it because it has stopped
If that's the case, then my NANY 2013 entry KeepUpApp as featured here, could be of interest to you. It won't work if the service isn't responding for any reason though.