Alright, this blog is only a few days old, and I’m already on my second windows-exclusive post. I’m risking being labeled as the blog’s resident “Microsoft FanBoy”. Oh well, I like to live dangerously!
Windows services. They’re executable code that runs in the background. A fair amount of them are part of the windows operating system, while others are part of programs that users install. For example, iTunes has a windows service that does something with your ipod. (I don’t know exactly what, but “iPodService” sound suspiciously like having to do with the ipod to me).
Additionally, you as a programmer can write windows services! This can be used for all sorts of nifty things. For example, when administering multiple remote computers displaying information to patrons, I used a windows services that would take a screenshot of the remote machines every 30 seconds and dump it to a network drive. I used this to just keep an eye on the machines – make sure that nothing popped up unexpectedly, error messages, and the like. Another example might be to set up messages systems between computers without it being in the users face.
First, I’ll talk about how to navigate to them, start, and stop them as a regular user, then I’ll address taking advantage of them as a programmer.
As An Average User
You can access the services by
- [Control Panel] –> [Administrative Tools] OR right-click [My Computer] –> [Manage]
- In the left-hand pane of the resulting window, expand [Services and Applications] and click on [Services]
- You should now see something like the image below, there all of the services are listed.

Windows Services Management
After selecting a service, a brief description will appear in the middle. Some descriptions are better than others (some say “service to help ipod”, while others give more details). In the list of services, you can see which ones are running and (Started) and which ones aren’t (blank). You can also see if the service is set to start automatically (when windows starts) or manually (when requested to). You can start or start a service by right-clicking on it. You can set a service to start either manually or automatically by right-clicking and going to ‘properties’. Note: There are some services that you will definitely not want to stop. Be sure you know what you’re stopping.
As a Programmer
There are varying ways to create a windows service programatically, so I won’t go into too many details here. When writing anything that I know will be run exclusively on a windows system, my favorite language is C#. CodeProject has a nifty tutorial on creating a windows service with C#. Actually, it covers pretty much everything here.
Anyway, for more information on creating a windows service in other languages check out MSDN’s page on creating win services programatically.
After you’ve written the project, you’ll need to install the service. You may either do this manually from the command prompt, or via a windows installer. If this program is just for personal use, and not for distribution, I’d suggest manually.
Open a command shell in windows and enter:
installutil yourproject.exe
To uninstall the service
installutil /u yourproject.exe
If you get the response ‘installutil’ is not recognized you may need to cd into the directory which contains your .NET framework, typically something like the following (though the version number may change)
cd c:\windows\microsoft.net\framework\v2.0.50727
View Comments
blog comments powered by