![]() ![]() |
Sep 24 2006, 11:44 AM
Post
#1
|
|
|
LAN Geek Group: Super Moderator Posts: 2937 Joined: 24-September 05 From: Ft Meade, Maryland, USA Member No.: 74319 OS: XP Pro x86
|
I wanted to setup some programs to run as Windows Services but found information on the subject to be scattered around everywhere. So this post is basically for consolidation and clarification but is not focused on unattended installations.
What is a Service? A Windows Service is automatically started when your system boots. There is no need to logon to the system. Services also are not affected by people logging off. Services automatically recover from program crashes and Standby and Hibernation modes. Windows 9x/ME do not have a Service facility. Installing software as a Service requires Administrator permissions. What are the options for running a program as a Service?
|
|
|
|
Sep 25 2006, 05:24 AM
Post
#2
|
|
|
MSFN Junkie Group: Software Developers Posts: 4316 Joined: 23-July 04 From: Italy Member No.: 25215 OS: none
|
Very interesting post!
I may add (Freeware for non commercial use): NTWRAPPER http://www.duodata.de/ntwrapper/index.htm Codeproject (Sourcecode only) - any taker to compile it?: XYNTSERVICE http://www.codeproject.com/system/xyntservice.asp jaclaz |
|
|
|
Sep 25 2006, 04:02 PM
Post
#3
|
|
|
LAN Geek Group: Super Moderator Posts: 2937 Joined: 24-September 05 From: Ft Meade, Maryland, USA Member No.: 74319 OS: XP Pro x86
|
Thanks, jaclaz
NT Wrapper looks great but I can't find the differences between the Lite and Pro versions. Do you know? The Lite version also comes with a neat app called SaferTray which helps keep wandering icons in the tray where they belong. I looked at that other app previously but didn't include it since it is aimed at programmers instead of users. But if you look at the comments at the bottom of the page you will see the familiar name Bilou_Gateux! I wonder if he got a copy and if it is suitable for use here? /me PMs him |
|
|
|
Sep 25 2006, 07:37 PM
Post
#4
|
|
|
Coffee Aficionado Group: Super Moderator Posts: 3266 Joined: 14-July 04 From: Coffeeland Member No.: 24596 OS: Vista Ultimate x64
|
NT Wrapper looks great but I can't find the differences between the Lite and Pro versions. There's a chart on that page. SMP/CPU binding only in pro version; Lite version limited to one service/machine only Pro version has offline help and support. Codeproject (Sourcecode only) - any taker to compile it?: Absolutely! I would, but there's no need for that as there's also a pre-compiled version along with the source in the zip file. If you have no account (req'd to download) and don't want to signup, then try bugmenot. |
|
|
|
Sep 25 2006, 08:03 PM
Post
#5
|
|
|
LAN Geek Group: Super Moderator Posts: 2937 Joined: 24-September 05 From: Ft Meade, Maryland, USA Member No.: 74319 OS: XP Pro x86
|
So there is.
I will blame this blunder on my sometimes over-eager filtering proxy. I see the table when I bypass it. Thanks! Being limited to one service would be a deal breaker for me. How many apps do you guys think most people need to run as a service? I need at least two, but probably three. |
|
|
|
Sep 25 2006, 10:43 PM
Post
#6
|
|
|
Coffee Aficionado Group: Super Moderator Posts: 3266 Joined: 14-July 04 From: Coffeeland Member No.: 24596 OS: Vista Ultimate x64
|
Being limited to one service would be a deal breaker for me. How many apps do you guys think most people need to run as a service? I need at least two, but probably three. Hard to tell... Personally I don't use any of these apps as Visual Studio will let you create your own services when you need one... (and even an installer for it and all - example with source code here) But there are likely reasons to run other apps as a service like that (not that I've ever had the need - most apps that need or would benefit from this already take care of it, like web/ftp servers). I can understand he wants to charge for it though - not that it's a very complex app or anything, but it takes time to design/code/make installer, write proper documentation, create a website for it (pay associated costs too), pay for hosting, end up having to support people (some people will ask questions - so you need email or a forum or something - and it can take a fair amount of time to answer those), maintain/bugfix/enhance it, etc. Understandable he wants to get some of that money back (or be paid for part of his time spent). So he's putting some artificial limitations on it to get their users with the most needs to pay for it. Thing is, it's easy to create a simple app like that, and there's already some free & open source options (I bet one would find some stuff on sourceforge too). So people are mostly paying for convenience (they don't want to have to write or compile code or such things) - that and support. Someone with some knowledge and time will use something else or just "roll their own" basically. People with simple needs will use the free version, others will either pay ~20$/PC or find something else if that's too much (but then you need to spend time looking for something else and such - not as "convenient")... Personally, I'd rather use something that I have the source for (willing to fix/enhance/modify it as req'd) |
|
|
|
Sep 26 2006, 12:16 AM
Post
#7
|
|
|
Junior ![]() Group: Members Posts: 91 Joined: 24-January 06 From: Netherlands Member No.: 86123
|
I have used vbscript in the past to create services:
CreateService.vbs CODE Const OWN_PROCESS = 16 Const NOT_INTERACTIVE = False Const NORMAL_ERROR_CONTROL = 2 strComputer = "." Set objWMIService = GetObject("winmgmts:" & _ "{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2") Set objService = objWMIService.Get("Win32_BaseService") errReturn = objService.Create("DbService", _ "NAME", _ "C:\WINDOWS\PROGRAM.EXE", _ OWN_PROCESS, _ NORMAL_ERROR_CONTROL, _ "Manual", _ NOT_INTERACTIVE, _ "NT AUTHORITY\LocalService", "") RemoveService.vbs CODE strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colListOfServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where Name = 'SERVICE_NAME'") For Each objService in colListOfServices objService.StopService() objService.Delete() Next I do believe that this will work only for programs that are meant to run as a service. |
|
|
|
Sep 26 2006, 10:15 AM
Post
#8
|
|
|
Powered by Windows Embedded ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 751 Joined: 3-January 04 From: Underworld Member No.: 11874 OS: XP Pro x86
|
Very interesting post! I may add (Freeware for non commercial use): NTWRAPPER http://www.duodata.de/ntwrapper/index.htm Codeproject (Sourcecode only) - any taker to compile it?: XYNTSERVICE http://www.codeproject.com/system/xyntservice.asp jaclaz XYNTSERVICE GUI wrapper with compiled version This post has been edited by Bilou_Gateux: Sep 26 2006, 10:18 AM |
|
|
|
Sep 26 2006, 12:29 PM
Post
#9
|
|
|
MSFN Junkie Group: Software Developers Posts: 4316 Joined: 23-July 04 From: Italy Member No.: 25215 OS: none
|
QUOTE (Bilou_Gateux) XYNTSERVICE GUI wrapper with compiled version I stand (pleasantly) corrected. jaclaz |
|
|
|
Sep 27 2006, 10:25 AM
Post
#10
|
|
|
MSFN Addict ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1760 Joined: 22-May 05 From: Paris Member No.: 57090 OS: none
|
I have used vbscript in the past to create services: CreateService.vbs CODE Const OWN_PROCESS = 16 Const NOT_INTERACTIVE = False Const NORMAL_ERROR_CONTROL = 2 strComputer = "." Set objWMIService = GetObject("winmgmts:" & _ "{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2") Set objService = objWMIService.Get("Win32_BaseService") errReturn = objService.Create("DbService", _ "NAME", _ "C:\WINDOWS\PROGRAM.EXE", _ OWN_PROCESS, _ NORMAL_ERROR_CONTROL, _ "Manual", _ NOT_INTERACTIVE, _ "NT AUTHORITY\LocalService", "") RemoveService.vbs CODE strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colListOfServices = objWMIService.ExecQuery _ ("Select * from Win32_Service Where Name = 'SERVICE_NAME'") For Each objService in colListOfServices objService.StopService() objService.Delete() Next I do believe that this will work only for programs that are meant to run as a service. Afaik, windows DOS-style programs have a main function, graphical ones a winmain one and services have serv(ice)main or so function. So a program needs to be designed to run as a service and moreover, services receive some specific messages (shutting down and co.) your program should handle if you want it not to simply die when you power your computer off. [*]Launcher Service Camarade_Tux recommends Launcher Service. It is free and open source and looks very flexible and useful. This program has several unique features:
... to be continued. |
|
|
|
Sep 30 2006, 12:11 PM
Post
#11
|
|
|
Newbie Group: Members Posts: 18 Joined: 12-May 06 Member No.: 96171
|
Do you think it is possible to make a program starting as a service during Unattended?
Say it's some kind of driver (dll or sys) that can act as a service after regular installation. I think Bilou_Gateux did something similar |
|
|
|
Sep 30 2006, 02:04 PM
Post
#12
|
|
|
MSFN Junkie ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Banned Posts: 3399 Joined: 4-December 05 Member No.: 81511 OS: none
|
Noone mentioned the "at xx:xx program.exe" ? This uses the task manager to run a program as a service at a specific time (and under full-priviledge System account too...)
|
|
|
|
Oct 1 2006, 11:12 AM
Post
#13
|
|
|
LAN Geek Group: Super Moderator Posts: 2937 Joined: 24-September 05 From: Ft Meade, Maryland, USA Member No.: 74319 OS: XP Pro x86
|
@LLXX: Please explain.
@kitaec: Some of the methods in this thread can be used for unattended. Look at sc.exe and the vbscript. |
|
|
|
Oct 1 2006, 01:57 PM
Post
#14
|
|
|
Newbie Group: Members Posts: 18 Joined: 12-May 06 Member No.: 96171
|
TAiN
Thank you. But doesn't sc.exe applies to .EXE files? And if there is a .SYS file (say - system driver)? And there are two .INF files with it which install and specify this .SYS as a service. But they don't make it to start like a service Vbscripts can't be used for some reason |
|
|
|
Oct 2 2006, 02:15 AM
Post
#15
|
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 444 Joined: 29-August 06 From: The Netherlands Member No.: 108885
|
Excellent topic; should be made sticky IMHO
|
|
|
|
Jul 26 2007, 08:12 AM
Post
#16
|
|
|
LAN Geek Group: Super Moderator Posts: 2937 Joined: 24-September 05 From: Ft Meade, Maryland, USA Member No.: 74319 OS: XP Pro x86
|
But doesn't sc.exe applies to .EXE files? Yes. What are you trying to do?Just stumbled onto this page today: Quick Start Multiple Services using Batch and Net Nothing new, but demonstrates usage of the batch commands. |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 4th July 2009 - 01:05 AM |