Reputation: 8108
As part of an installation, I need to be able to identify the instances and versions of SQL Server installed on a machine.
I am using this approach to get a list of the instances of SQL server on the local machine; I'm only interested in the local machine.
I need to get all instances, and check the versions. We need SQL Server 2008 R2 for the application.
However, what I get back is:
"MACHINENAME"
"MACHINENAME"
{}
true
{} (**)
true
whereas I was expecting (**) to have the version in it.
I see that this technique fails if there is a firewall in place:
This method fails to list the local instance if a firewall is operating on the server. The firewall blocks any broadcast traffic issued when the method is called, even if the sender is from local machine.
but I get the same result, regardless of enabling or disabling the firewall.
Are there any suggestions as to what I am doing wrong?
Upvotes: 0
Views: 117
Reputation: 8790
I don't know, but after you get the list of servers back just query them. You can either use a SqlCommand to send a "select @@version" query, or you could use the Server class in the Microsoft.SqlServer.Management.Smo namespace to get this information.
Upvotes: 1