Question: I have written a tool that is run on the command line.  

I can test it on the command line on my machine, and it works fine.  

I then remote into the target server machine and run it on the command line there, and it still works.  

**However**...this tool needs to remain running (*its a monitoring tool*).  

I can't leave my remote session to that machine open for too long, as other people need to use it, and when I close my remote session, that command line tool ends.  

I don't know how to, and would like to avoid needing to, write a windows service, but essentially I need that capability. I need to almost wrap my command line tool with a windows service that can remain running on the target machine while I disconnect.

Can anyone provide any insight/strategy on how to do this?

**Edit:**  

Both of the below posts are helpful.

Answer: 
See if this page helps:

<http://www.msfn.org/board/topic/83272-how-to-run-a-program-as-a-service/>
An alternate solution is to use the [PsExec](http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx) to launch your monitoring tool on the remote machine in detached mode, i.e.:

```
PsExec.exe \\remote_machine -d C:\...\monitoring_tool.exe

```

PsExec.exe launches monitoring\_tool.exe on the remote machine and then terminates itself. It does not wait for monitoring\_tool.exe to terminate.