Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

starting as a windows service

Thread Tools
 
Search this Thread
 
Old 18 May 2003, 05:28 PM
  #1  
djuk
Scooby Regular
Thread Starter
 
djuk's Avatar
 
Join Date: Jun 2002
Location: Berkshire
Posts: 1,280
Likes: 0
Received 0 Likes on 0 Posts
Question

I have a command line (its an ip-tunnel application) which i currently run on one of my machines at startup which is fine but its currently run from a batch file and sits on the task bar all the time which is a bit messy and vunerable to being shut down accidently. Is there any way to execute this command line on startup as a service or otherwise hidden?

Old 18 May 2003, 06:22 PM
  #2  
David_Wallis
Scooby Regular
 
David_Wallis's Avatar
 
Join Date: Nov 2001
Location: Leeds - It was 562.4bhp@28psi on Optimax, How much closer to 600 with race fuel and a bigger turbo?
Posts: 15,239
Likes: 0
Received 1 Like on 1 Post
Post

theres a utility in the resource kit.. bit.. apps shouldnt really be run as services.. mail me if you cant find it..

David
Old 18 May 2003, 06:33 PM
  #3  
ozzy
Scooby Regular
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

You need the files instsrv.exe and srvany.exe to install and run the utility as a service. Copy both to your %systemroot%\System32\ folder i.e. c:\winnt\system32 OR c:\windows\system32 (if XP)

The install command from a batch file would be:-

%systemroot%\system32\instsrv servicename %systemroot%\system32\srvany.exe

This will create a servive entry under HKLM\system\currentcontrolset\services\

You'll need to create a Paramter key under the new service with the following string values:-

AppDirectory
Application

The value of AppDirectory would be the folder holding the application executable and the Application value would hold the name and full path to the .exe file.

e.g. AppDirectory = "C:\appfolder" & Application = "C:\appfolder\app.exe"

I use a batch file to install the seti client as a service, so I mail you my install script for an idea of how it's done.

Stefan
Old 18 May 2003, 06:36 PM
  #4  
ozzy
Scooby Regular
 
ozzy's Avatar
 
Join Date: Nov 1999
Location: Scotland, UK
Posts: 10,504
Likes: 0
Received 1 Like on 1 Post
Post

OK, I would e-mail you if you had an e-mail address in your profile.

Here's the batch script:-

rem
rem create Seti directory
rem
mkdir %systemroot%\System32\SAH
%systemroot%\System32\Attrib +h %systemroot%\System32\SAH
rem
rem copy files
rem
copy instsrv.exe %systemroot%\System32\instsrv.exe
copy srvany.exe %systemroot%\System32\srvany.exe
copy SAH.exe %systemroot%\System32\SAH\SAH.exe
copy user_info.sah %systemroot%\System32\SAH\user_info.sah
copy setiwatch.exe %systemroot%\System32\SAH\setiwatch.exe
rem
rem Create new services
rem
%systemroot%\System32\instsrv SAH %systemroot%\System32\srvany.exe


And here's the registry (.reg) file needed for the new service:-

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SAH]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,7 4,25,5c,53,79,73,74,65,6d,33,\
32,5c,53,52,56,41,4e,59,2e,45,58,45,00
"DisplayName"="SAH"
"ObjectName"="LocalSystem"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SAH\Parameters]
"AppDirectory"="C:\\WINNT\\System32\\SAH\\"
"Application"="C:\\WINNT\\System32\\SAH\\sah.e xe"
"AppParameters"=""


If you need the two files, e-mail me and I'll send you them.

Stefan
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
SilverM3
ScoobyNet General
8
24 February 2021 01:03 PM
hardcoreimpreza
Computer & Technology Related
21
11 October 2015 03:40 PM
T.K
General Technical
10
02 October 2015 11:35 AM
ALEXSTI
General Technical
5
28 September 2015 09:29 PM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM



Quick Reply: starting as a windows service



All times are GMT +1. The time now is 12:17 PM.