Discussion:
[Unattended] instsrv troubles - how to add a parameter to EXE file?
Gerhard Hofmann
2005-04-01 07:44:09 UTC
Permalink
Hi all,

I try to install a service with instsrv.exe from Windows Resource Kit.

usage
instsrv.exe ServiceName c:\myprog\myprog.exe
works. Problem: the service needs some parameters. I tried
instsrv.exe ServiceName "c:\myprog\myprog.exe -myparam1 -myparam2"
and this won't work.

instsrv.exe takes the whole expression as a file name and says
unable to find the file at the given path

Any ideas?

TIA
Gerhard
Stefan Kell
2005-04-01 07:59:45 UTC
Permalink
Hi Gerhard,
Post by Gerhard Hofmann
Hi all,
I try to install a service with instsrv.exe from Windows Resource Kit.
usage
instsrv.exe ServiceName c:\myprog\myprog.exe
works. Problem: the service needs some parameters. I tried
instsrv.exe ServiceName "c:\myprog\myprog.exe -myparam1 -myparam2"
and this won't work.
instsrv.exe takes the whole expression as a file name and says
unable to find the file at the given path
Any ideas?
TIA
Gerhard
parameters to services are in the registry, so you have to change the
registry. The key is something like
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName".
Navigate to the Parameters subkey. If there isn't one, you have to create
it.

There is a tool in the resourcekit which will do this, see
"http://support.microsoft.com/?kbid=251192"

Regards

Stefan Kell
Gerhard Hofmann
2005-04-01 10:01:32 UTC
Permalink
Post by Stefan Kell
parameters to services are in the registry, so you have to change the
registry. The key is something like
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName".
Navigate to the Parameters subkey. If there isn't one, you have to create
it.
There is a tool in the resourcekit which will do this, see
"http://support.microsoft.com/?kbid=251192"
Thanks, this was very helpful!
sc config ServiceName binpath = "c:\myprog\myprog.exe -myparam"
was the solution.

Regards
Gerhard
Allan Stones
2005-04-04 00:45:06 UTC
Permalink
Post by Stefan Kell
Hi Gerhard,
Post by Gerhard Hofmann
Hi all,
I try to install a service with instsrv.exe from Windows Resource Kit.
usage
instsrv.exe ServiceName c:\myprog\myprog.exe
works. Problem: the service needs some parameters. I tried
instsrv.exe ServiceName "c:\myprog\myprog.exe -myparam1 -myparam2"
and this won't work.
instsrv.exe takes the whole expression as a file name and says
unable to find the file at the given path
Any ideas?
TIA
Gerhard
parameters to services are in the registry, so you have to change the
registry. The key is something like
"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName".
Navigate to the Parameters subkey. If there isn't one, you have to create
it.
There is a tool in the resourcekit which will do this, see
"http://support.microsoft.com/?kbid=251192"
Regards
Stefan Kell
-------------------------------------------------------
A global provider of Threat Management Solutions.
Download our HomeAdmin security software for free today!
http://www.demarc.com/info/Sentarus/hamr30
_______________________________________________
unattended-info mailing list
https://lists.sourceforge.net/lists/listinfo/unattended-info
Id like to point you to the scripts that WPKG use to install their service.

### wpkg-install.bat ###

:: Install Windows Packager

if exist "%SystemRoot%\System32\srvany.exe" goto srvany_installed
copy \\ntinstall\wpkg\files\srvany.exe %SystemRoot%\System32
:srvany_installed

if exist "%SystemRoot%\System32\instsrv.exe" goto instsrv_installed
copy \\ntinstall\wpkg\files\instsrv.exe %SystemRoot%\System32
:instsrv_installed

instsrv "Windows Packager" "%SystemRoot%\System32\srvany.exe"
\\ntinstall\wpkg\files\scripten.exe /Q /R:N
cscript.exe \\ntinstall\wpkg\files\install-service.js
net start "Windows Packager"



### install-service.js ###

var WshShell = WScript.CreateObject("WScript.Shell");
var srvKey = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Windows
Packager\\Parameters\\";
var appKey = srvKey + "Application";
var parKey = srvKey + "AppParameters";
var srvPath = WshShell.ExpandEnvironmentStrings("%SystemRoot%") +
"\\System32\\cscript.exe"
var srvArgs = "\\\\ntinstall\\wpkg\\wpkg.js /synchronize /quiet";
WshShell.RegWrite(appKey, srvPath, "REG_SZ");
WshShell.RegWrite(parKey, srvArgs, "REG_SZ");


i hope they help in some way :)
--
Allan Stones
Optiver Australia PTY LTD
Junior Systems Administrator
Suite A, 1-3 Brodie Street,
Paddington, NSW, 2021,
Australia
Phone: +61(2)9333 4078
Fax : +61(2)9333 4044
Email: ***@optiver.com.au
Web : http://www.optiver.com.au
Loading...