cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
D-2_5-GT
Level 3

Possible to Query a Windows Service Username?

I'm trying to update a windows service that is already present on a system. The service has been previously installed and assigned a specific user account to run under.

Is there a way to query the user name and password from this existing service so i can preserve and replace this info when i install the new version?
Labels (1)
0 Kudos
(5) Replies
Cary_R
Level 11

Hi there,

Username is easy, password much less so:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ServiceName\ObjectName

You won't even be able to query for where the passwords are stored without using low-level Windows API's. Decrypting them is another task entirely:

http://www.pctools.com/forum/showthread.php?6874-Opening-keys-under-HKLM%5CSecurity%5CPolicy%5CSecrets

Needless to say, it's clear that Microsoft doesn't want you doing this sort of thing.

Your best bet is to plan ahead for this for next time, storing the username and password in the registry in an encrypted fashion, to be re-read during upgrades and maintenance. This is basically what InstallShield does with its SQL functionality to let SQL Scripts run during uninstall.

As for this time around, you might be able to get this going by stopping the service, overwriting the service binary and restarting the service. However, accomplishing this while following all the various rules of Windows Installer is going to be a bit tough.

It'd be a rather long discussion on how to implement all of , but it goes without saying that our Professional Services department is available should you want some expert guidance on implementing a solution.
0 Kudos
TsungH
Level 12

Are you certain the password for SQL stored in registry by IS2011 is indeed encrypted?
Cary R wrote:
Your best bet is to plan ahead for this for next time, storing the username and password in the registry in an encrypted fashion, to be re-read during upgrades and maintenance. This is basically what InstallShield does with its SQL functionality to let SQL Scripts run during uninstall.
0 Kudos
Cary_R
Level 11

TsungH wrote:
Are you certain the password for SQL stored in registry by IS2011 is indeed encrypted?


Yes, I am certain. Check:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield Uninstall Information\[ProductCode]\SQLServer\SqlConnectionName

If you have any doubt.
0 Kudos
TsungH
Level 12

Well, I saw the password in plaintext when I tried it a few months back. I will try again after my vacation, when I get a chance. The earliest will be in Sept, that is if I still remember.
0 Kudos
Cary_R
Level 11

It may have been plaintext at one point, but for at least as far back as InstallShield 12 or 2008 it would have been encrypted.

My test was with IS2011.
0 Kudos