Detect SQL Server (Express) Existence Programmatically

At a customer’s request, I did a quick search on the web and found a few suggestions and discussions below. I tested the code provided by my colleague Parikshit Savjani more than six years. And believe it or not, it works! The sample code is available for download here.

When No SQL Server Instance Present

image

After SQL Server Express 2012 (64-bit) Installed

image

image

Find all instances of sql server programmatically
https://stackoverflow.com/questions/13363215/find-all-instances-of-sql-server-programmatically

Programmatically checking for installation of Microsoft SQL Server 2008 Native Client
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a182caa6-2fd7-498c-afb7-47c49fcd6c11/programmatically-checking-for-installation-of-microsoft-sql-server-2008-native-client?forum=sqlgetstarted

Enumerating Available Packages Programmatically
https://msdn.microsoft.com/en-us/library/ms403343.aspx

HOW TO DETECT SQL SERVER INSTANCES / FEATURES INSTALLED ON A MACHINE
https://blogs.msdn.com/b/sqlserverfaq/archive/2009/03/07/how-to-detect-sql-server-instances-features-installed-on-a-machine.aspx