Check if SQL server is installed and collect instance information - Advanced Installer Community
dlenis
Posts: 40
Joined: Wed Nov 02, 2016 2:37 pm

Check if SQL server is installed and collect instance information

I need to check if SQL server 2012 or higher is installed and collect information on all SQL instances installed locally. I can’t use the predefined condition ((AI_DETECTED_SQLEXPRESS_VERSION >= "2012") to check since it will also return true if SQL 2012 express is installed and does not provide all the information we need. The express addition will not work with our application.

With PowerShell I can check for all SQL server instances and collect the necessary information. Script works great outside of Advanced Installer but fails when run from a custom action. It is not able to read the require registry key even if package is set to run as administrator. I can't set custom action to "run under local system account with full privileges" since it needs to run during the wizard page stage. I did try running it in the install stage but the option still remains grayed out.

I decided to try another approach and use the custom search feature but the issue is the required registry key is not display for selection:
The required key is: HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names.
The Registry key.jpg is the view from "regedit" which shows the required key. Second image "AI.jpg" shows the search key action from Advanced Installer with the key missing. I've compared the "Instance Names" key permission with other keys that are visible from Advanced Installer and they have identical permissions. Any ideals why the key is not showing or possible alternatives to what we are trying to accomplish?

Thank you,

Diego
Attachments
Registry key.JPG
Registry key.JPG (42.64 KiB) Viewed 6363 times
AI.JPG
AI.JPG (37.8 KiB) Viewed 6363 times
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Check if SQL server is installed and collect instance information

Hi Diego,

Indeed, this is a limitation in the registry entry browser. We will try to avoid it in a future version.

Until then you can manually specify the registry path in key field.

By the way, did you noticed our predefined support for SQL Server browse operation? To visually discover this feature, please take a look on the SQL Browsing video.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dlenis
Posts: 40
Joined: Wed Nov 02, 2016 2:37 pm

Re: Check if SQL server is installed and collect instance information

Dan,
I was able to accomplish what I needed through a C# custom action. It uses the same methods to read the registry keys as in the PowerShell script. I am not able to use your SQL Browsing dialog since this page is strictly to validate all minimum system requirements.

Thank you,

Diego
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Check if SQL server is installed and collect instance information

You're welcome Diego,

I'm glad you got this working.
Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”