Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I am trying to get the names of all SQL server instances on the network. I am using the SMO (server management objects). The problem is that the call to
SmoApplication.EnumAvailableSqlServers(false)
returns a DataSet containing only the names of the servers not the installed instances. Even though there are multiple instances installed on single machine I get only one DataRow representing that machine. What is even worst is that the "Instance" DataColumn is empty(DBNull.Value). In the test environment I am using SQL server 2008 express. If anybody has any idea what could be the reason for that or knows any other approach to achieve the described functionality please let me know. Any advice will be appreciated.

Uros
Posted

Hi

It turn's out that the solution was simpler than I thought. The problem was that the SQL Server Browser service was stopped. When running the above smo command while the service is started you get all the running instances along with their properties(InstanceName, Version, IsClustered ...)

Uros
 
Share this answer
 
Have a look at this CodeProject article.Locate SQL Server instances on the local network[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900