This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: automating user name and password for a service
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 09, 2009
09:43 AM
automating user name and password for a service
My InstallScript MSI project under InstallShield 2009 Professional is working fine with a windows service component in one of the features successfully installed with a fixed User Name and Password set in the Component's Advanced Settings | Install NT Service property. Now I need to be able to dynamically set these values during the installation. I am able to prompt the user for these values via SdLogonUserInformation function. But the challenge is setting these values in to the component property at run time. Any ideas? The closest thing I found was the FeatureSetData() function. But its nInfo parameter does not have a corresponding numeric value for these settings (user name, password). Any pointers or sample code will be appreciated.
Thanks in advance.
Thanks in advance.
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 09, 2009
12:15 PM
armyedsp wrote:
My InstallScript MSI project under InstallShield 2009 Professional is working fine with a windows service component in one of the features successfully installed with a fixed User Name and Password set in the Component's Advanced Settings | Install NT Service property. Now I need to be able to dynamically set these values during the installation. I am able to prompt the user for these values via SdLogonUserInformation function. But the challenge is setting these values in to the component property at run time. Any ideas? The closest thing I found was the FeatureSetData() function. But its nInfo parameter does not have a corresponding numeric value for these settings (user name, password). Any pointers or sample code will be appreciated.
Thanks in advance.
If you find a more advanced way I'd love to hear it, but the method I'm currently using is to install my services as LocalSystem, then after InstallServices I execute a custom action that updates the service using the windows "sc.exe" tool.
the syntax is:
[CODE]sc.exe config [SERVICENAME] obj= [USERNAME] password= [PASSWORD][/CODE]
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2009
10:04 AM
Thanks schmoli. I appreciate your post. I got it working through sc.exe just as you stated. But I could not get the command to execute successfully from within a custom action (doesn't matter if the CA is inserted after InstallServices or StartServices in the execute sequence). I do see a DOS window flash by. Because I was able to execute the command manually from a DOS prompt, I decided to create a mycmd.bat file and placed a pause command in the batch after the sc in an attempt to see what errors if any are reported from the sc. However, the LaunchAppAndWait does not execute a batch from CA! So, I decided to simply invoke the sc from within OnFirstUIAfter. So, in short, I got it to work but not from a custom action as you stated.
It would be nice to be able to simply update the formatted data for user name and password in the msi service table from within installscript.
Thanks again.
It would be nice to be able to simply update the formatted data for user name and password in the msi service table from within installscript.
Thanks again.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2009
12:06 PM
Glad you got it working, not sure why you were unable to execute it from a CA (are you sure you set it as a Commit CA? it needs to execute after the services are installed [so that there is something to modify]). As far as debugging, what I usually do is replace "sc.exe" with "cmd /k sc.exe" so that you will get a DOS box to appear, and show you your output w/o exiting, so that you can determine the issue (and test possible fixed command lines before typing 'exit').
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jan 12, 2009
04:16 PM
Thans again. It works now. I had the CA set for Immediate Execution. Corrected that, and that fixed it. Thanks again for your help. I appreciate it.