# How to check existence of a Windows Service on target machine?

**URL:** https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324
**Category:** Discussion
**Created:** [November 26, 2014, 7:55am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324 "2014-11-26T07:55:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![samc](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@samc](https://www.finalbuilder.com/forums/u/samc)
#### Post date: [November 26, 2014, 7:55am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324/1 "2014-11-26T07:55:45Z")

</div>

Hi,  
  
I’m using FinalBuilder 6.3 and my build project starts/stops windows services. I’d like to expand the scope of the project to allow it to be more portable and scalable by getting it to install the services as well. Is there a recommended set of steps for detecting Windows Services are installed? I can remotely execute the process to do the install but was seeing if there was a nice way to check for service existence?  
  
Thanks,  
Sam

---

<div class="post-metadata">

### Author: ![samc](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@samc](https://www.finalbuilder.com/forums/u/samc)
#### Post date: [November 26, 2014, 8:00am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324/2 "2014-11-26T08:00:00Z")

</div>

Sorry forgot to add this - the source and target machines are Win2k8 R2 x64. FB version is 6.3.0.2253.

---

<div class="post-metadata">

### Author: ![davestiff](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/d/f08c70/32.png) [@davestiff](https://www.finalbuilder.com/forums/u/davestiff)
#### Post date: [November 26, 2014, 2:40am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324/3 "2014-11-26T02:40:12Z")

</div>

Hi Sam,  
  
I’ve never used FB6 but FB7 has the PSService action. Does version 6 have this as well?  
  
The action wraps the psservice.exe from SysInternals.  
  
Thanks,  
Dave

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [November 26, 2014, 11:17am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324/4 "2014-11-26T11:17:47Z")

</div>

Hi All,   
  
 With detecting if a service is present on a machine. Running a "net stop " will only work if the service is installed. If it fails with an error message of “the service name is invalid” (I believe there is a specific error code for this as well) then you can assume the service is not installed. Another way is to use PsTools psservice command.   
  
 The best way is to use the FinalBuilder 7 PsService action. We have done all the hard work for you.

---

<div class="post-metadata">

### Author: ![samc](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@samc](https://www.finalbuilder.com/forums/u/samc)
#### Post date: [November 26, 2014, 11:41am UTC](https://www.finalbuilder.com/forums/t/how-to-check-existence-of-a-windows-service-on-target-machine/2324/5 "2014-11-26T11:41:57Z")

</div>

Thank you. Will investigate these options.
