-1

I have already designed an exe and Now I want to launch this EXE using windows service. main purpose it to check after every 30 minutes either that EXE is running or not using that windows service. If not running then windows service will start that EXE from installed location.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123

3 Answers3

2

Write a program to check another exe is running or not.

Process.GetProcessesByName("target.exe").Length > 0

Use Windows Schedule Task, set the interval every 30 minutes to launch the check program.

linquize
  • 19,828
  • 10
  • 59
  • 83
2

It is easy to create a windows service using VB.NET File>New Project>Visual Basic>Windows>Windows Service (However I don't think the option to create a Windows Service Project is available in VB.NET Express)

Have a look at this link and this link for step by step instructions on how to do this.

Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
1

You could solve this using Task Scheduler in Windows, without having to create a windows service.

Got to Task Scheduler -> Task Scheduler Library -> Create Task

On the Triggers tab, create a new schedule trigger with "Repeat task every..." set to 30 minutes.

On the Settings tab, make sure that "Do not start a new instance" is selected.

Alf Kåre Lefdal
  • 643
  • 1
  • 6
  • 27
  • I want to push that exe to a clients through domain policy and installer will install said exe and that installer will also push service to run that exe auto. – user1648239 Sep 05 '12 at 11:00
  • Scheduled tasks can be created using installers: http://stackoverflow.com/questions/1774764/vista-schedule-task-from-setup – Alf Kåre Lefdal Sep 06 '12 at 07:40