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

8565 questions
182
votes
19 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
  • 27,156
  • 27
  • 70
  • 82
173
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
  • 6,678
  • 5
  • 43
  • 58
172
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,387
  • 8
  • 26
  • 34
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,956
  • 8
  • 28
  • 35
163
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
  • 45,595
  • 16
  • 119
  • 161
158
votes
14 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,685
  • 5
  • 22
  • 25
156
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
  • 16,363
  • 13
  • 53
  • 59
155
votes
5 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,535
  • 10
  • 42
  • 50
154
votes
13 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,679
  • 2
  • 22
  • 29
151
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
  • 15,501
  • 38
  • 136
  • 233
141
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
  • 25,181
  • 26
  • 90
  • 147
140
votes
7 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,380
  • 8
  • 33
  • 58
140
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
  • 15,010
  • 24
  • 83
  • 128
134
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.
  • 17,602
  • 25
  • 84
  • 141
126
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
  • 9,331
  • 8
  • 36
  • 70