cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jchristman
Level 8

InstallScript Service params

I am currently using ServiceAddService to add a service but I would like to set the username and password to run the service and the recovery options to restart. I know this can be done with SERVICE_IS_PARAMS but cannot find examples of how it works or works with the ServiceAddService. Could someone show me a couple of examples of this.
Labels (1)
0 Kudos
(5) Replies
jchristman
Level 8

Currently this is what I have, but it will not compile saying numeric value required. even though what I have seen shows passing in the string values.


STRING szServiceUser, szServicePass;

ServiceInitParams ();
SERVICE_IS_PARAMS.dwServiceType = SERVICE_WIN32_OWN_PROCESS|SERVICE_INTERACTIVE_PROCESS;
SERVICE_IS_PARAMS.lpServiceStartName = szServiceUser;
SERVICE_IS_PARAMS.lpPassword = szServicePass;
ServiceAddService (szServiceName,szServiceName,szServiceName,MyService1,'');



The service I am adding in not a .Net service so it will not automatically prompt for username and password, is there a way to force this or am I on the right path.
0 Kudos
jchristman
Level 8

It appears that when I use the SERVICE_IS_PARAMS like above it does not install my service now or unintall it. Any suggestions on how I can get this to install the service with a user name and password
0 Kudos
RobertDickau
Flexera Alumni

Which line or lines give you the compiler errors? For the string fields, perhaps try:

SERVICE_IS_PARAMS.lpServiceStartName = &szServiceUser; // pointer to user name string
jchristman
Level 8

I believe I see what I was doing wrong I was not doing this as a pointer &szServiceUser. I am trying this now. Thanks.
0 Kudos

This was a very helpful post, thanks.

Could I ask that this kind of information is added to the online help (if it hasn't been already) so developers know how to use these parameters. Examples are always the most useful part of online help.

0 Kudos