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.
-
2Serious, have you tried searching? – Ian Goldby Sep 05 '12 at 07:41
-
Which part of this are you having trouble with? – Steven Doggart Sep 05 '12 at 12:21
-
possible duplicate of [Exe to service possible?](http://stackoverflow.com/questions/2550110/exe-to-service-possible) – Nathan Koop Sep 05 '12 at 19:42
3 Answers
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.

- 19,828
- 10
- 59
- 83
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.

- 26,994
- 10
- 93
- 143
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.

- 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