Archive: Detection of MSDE at user's computer


Detection of MSDE at user's computer
Hello Everybody,

Warm greetings from India!

I'm making an installer to install MSDE 2000. Its working fine (thanks for the help esp. to Bruno). Now I'm doing some refinement to it. How can I detect whether MSDE is installed in the user's computer or not. For the time being version/instance checking is not required...just want to check MSDE of any version is installed or not before I start MSDE Installation from NSIS Installer.

With regards,

p.s.:I've gone through materials on this forum related to this issue, but unable to decipher any simple and short solution to it.


Did you try from NSIS manual 4.9.4.10 IfFileExists,
or E.1.2 Locate, or get values from regisrty?


Yes, for the time being I'm using IfFileExists to detect MSDE in user's computer. But this method is not proper as the MSDE may be installed into any other location other then the default location. I'm giving the code, for others :

${If} ${FileExists} "$PROGRAMFILES\Microsoft SQL Server\80\Tools\Binn\sqlmangr.exe"
MessageBox MB_ICONEXCLAMATION|MB_OK "MSDE already installed!$\nSetup is terminating the installation process."
Quit
${Endif}

But friends, this is not the actual solution! I'm looking for some way to trap it from the registry. Precisely, if there is a way to read from the control panel's 'Add/Remove program lists. Is someone listening?!

With regards,


Hi Swapan Das!

I found an article. They mention a registry key. Maybe you can have a look in the registry of your installation and see what's in there.

HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer (\Setup)

[1] http://www.betav.com/Files/Content/W...files/msde.htm

Have a nice day!

Cheers

Bruno


I see...
You may want to read the NSIS manual at 4.9.2 Registry, INI, File Instructions.
ex
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\<MSDE Record>" "UninstallString"
StrCmp $R0 '' _notInstalled


Huh, there's a wiki article about SQL Server. It might be useful for you.

http://nsis.sourceforge.net/How_to_t...r_is_installed

Cheers

Bruno


Dear Friends!

Thanks a lot for all the help. After going through this issue while considering all the suggestions from all of you, I came with one solution.

If anyone is interested, can try my this tested code:

ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\MSSQLServer\Setup" SQLPath ;ProductCode
${If} $R0 == ""
;MessageBox MB_ICONEXCLAMATION|MB_OK "SQL Server not detected, press any key to install"
${Else}
MessageBox MB_ICONEXCLAMATION|MB_OK "SQL Server/MSDE already installed!$\nSQL Path:$R0$\nSetup is terminating the installation process."
Quit
${EndIf}


With regards,
Swapan


cool :-)


I've also posted a separate post for this at:
http://forums.winamp.com/showthread....hreadid=261330


Hi Swapan!

Thank you very much for this posting!

Could you create a wiki page on nsis.sf.net? There is a special section which deals with software detection. It would be nice to have this one there!

Cheers

Bruno


Thanks Bruno!

I'll definitely do it. But give me some time as I'm pre-occupied with many tasks at office. You know office job!


No worries! It's just great to collect those information in a central place so everyone has easy access... :-)


I found it handier to look for the instance instead. If it doesn't exist, I then check for the SQL service. I can then poll that to see if my database already exists or prompt for install.

In any case, you don't have to worry about where it is installed by looking for services. I use the same approach for IIS. If I don't find the service I throw up a prompt to install and execute sysocmgr on yes or abort virtual web page install on no. At least for me this has made a very clean approach for handling missing prerequisits.