- NSIS Discussion
- Detection of MSDE at user's computer
Archive: Detection of MSDE at user's computer
Swapan Das
4th December 2006 11:42 UTC
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.
Red Wine
4th December 2006 12:56 UTC
Did you try from NSIS manual 4.9.4.10 IfFileExists,
or E.1.2 Locate, or get values from regisrty?
Swapan Das
5th December 2006 11:56 UTC
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,
bholliger
5th December 2006 12:31 UTC
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
Red Wine
5th December 2006 12:43 UTC
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
bholliger
5th December 2006 12:50 UTC
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
Swapan Das
8th December 2006 07:30 UTC
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
Red Wine
8th December 2006 10:09 UTC
cool :-)
Swapan Das
8th December 2006 10:35 UTC
I've also posted a separate post for this at:
http://forums.winamp.com/showthread....hreadid=261330
bholliger
8th December 2006 11:06 UTC
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
Swapan Das
8th December 2006 11:14 UTC
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!
bholliger
8th December 2006 11:27 UTC
No worries! It's just great to collect those information in a central place so everyone has easy access... :-)
TypoBound
9th December 2006 13:40 UTC
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.