Questions tagged [windows-services]

Windows services are background service processes run by the Service Control Manager on Windows NT based operating systems, similar to daemons or UNIX services.

Windows services, also referred to as NT services, are background service processes run by the Service Control Manager based on the service settings and optionally restarted as needed. Windows services are also capable of being launched on demand, based on other service dependencies.

See also Introduction to Windows Service Applications

8974 questions
197
votes
9 answers

Run batch file as a Windows service

In order to run one application, a batch file has to be kicked off (which does things like start Jetty, display live logs, etc). The application will work only if this batch file is running. I am hence forced to have this batch file running and not…
publicRavi
  • 2,657
  • 8
  • 28
  • 34
197
votes
20 answers

How to force uninstallation of windows service

I installed a windows service using installUtil.exe. After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first. When I now try to uninstall the service, installUtil.exe completes the…
Manu
  • 28,753
  • 28
  • 75
  • 83
187
votes
7 answers

How to uninstall a Windows Service when there is no executable for it left on the system?

How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run installutil -u since there is not executable left on the system. I can still see an entry for the service in the Services console. The reason…
Magnus Lindhe
  • 7,157
  • 5
  • 48
  • 60
181
votes
14 answers

When creating a service with sc.exe how to pass in context parameters?

When creating Windows service using: sc create ServiceName binPath= "the path" how can arguments be passed to the Installer class's Context.Parameters collection? My reading of the sc.exe documentation is that such arguments could only be passed…
sympatric greg
  • 2,969
  • 2
  • 24
  • 29
176
votes
15 answers

Check if a Windows service exists and delete in PowerShell

I am currently writing a deployment script that installs a number of Windows services. The services names are versioned, so I want to delete the prior Windows service version as part of the installs of the new service. How can I best do this in…
Adrian Russell
  • 3,995
  • 5
  • 25
  • 26
174
votes
11 answers

How do you run CMD.exe under the Local System Account?

I'm currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to emulate this same behavior. Basically, I would like to…
Ben Griswold
  • 17,793
  • 14
  • 58
  • 60
174
votes
7 answers

Elevating process privilege programmatically?

I'm trying to install a service using InstallUtil.exe but invoked through Process.Start. Here's the code: ProcessStartInfo startInfo = new ProcessStartInfo (m_strInstallUtil, strExePath); System.Diagnostics.Process.Start (startInfo); where…
Scott Marlowe
  • 7,915
  • 10
  • 45
  • 51
172
votes
5 answers

How to create an installer for a .net Windows Service using Visual Studio

How do I create an installer for a Windows Service that I have created using Visual Studio?
Kelsey
  • 47,246
  • 16
  • 124
  • 162
170
votes
10 answers

.NET console application as Windows service

I have console application and would like to run it as Windows service. VS2010 has project template which allow to attach console project and build Windows service. I would like to not add separated service project and if possible integrate service…
Tomas
  • 17,551
  • 43
  • 152
  • 257
167
votes
7 answers

Install a .NET windows service without InstallUtil.exe

I have a standard .NET windows service written in C#. Can it install itself without using InstallUtil? Should I use the service installer class? How should I use it? I want to be able to call the following: MyService.exe -install And it will have…
Yuval Peled
  • 4,988
  • 8
  • 30
  • 36
148
votes
17 answers

How can a windows service programmatically restart itself?

I need to write robust code in .NET to enable a windows service (server 2003) to restart itself. What is the best way to so this? Is there some .NET API to do it?
Ron Harlev
  • 16,227
  • 24
  • 89
  • 132
147
votes
8 answers

Install Windows Service created in Visual Studio

When I create a new Windows Service in Visual Studio 2010, I get the message stating to use InstallUtil and net start to run the service. I have tried the following steps: Create new project File -> New -> Project -> Windows Service Project Name:…
jkh
  • 3,618
  • 8
  • 38
  • 66
146
votes
8 answers

How to install node.js as windows service?

I have downloaded node.js executable. How can I run that executable as windows service? I cannot use standard node.js installer, since I need to run multiple version of node.js concurrently.
TN.
  • 18,874
  • 30
  • 99
  • 157
144
votes
8 answers

How do I restart a service on a remote machine in Windows?

Sometimes while debugging, I need to restart a service on a remote machine. Currently, I'm doing this via Remote Desktop. How can it be done from the command line on my local machine?
Josh Kodroff
  • 27,301
  • 27
  • 95
  • 148
137
votes
7 answers

Start / Stop a Windows Service from a non-Administrator user account

I have a WindowsService named, say, BST. And I need to give a non-Administrator user, UserA, the permissions to Start/Stop this particular service. My service runs on a variety of Windows OS, starting from Windows Server 2003 to Windows 7. How can I…
Sach
  • 10,091
  • 8
  • 47
  • 84