SmoApplication.EnumAvailableSqlServers SmoApplication.EnumAvailableSqlServers SmoApplication.EnumAvailableSqlServers Method

Definition

Enumerates a list of available instances of SQL Server.

Overloads

EnumAvailableSqlServers() EnumAvailableSqlServers() EnumAvailableSqlServers()

Enumerates a list of available instances of SQL Server.

EnumAvailableSqlServers(Boolean) EnumAvailableSqlServers(Boolean) EnumAvailableSqlServers(Boolean)

Enumerates a list of local available instances of SQL Server.

EnumAvailableSqlServers(String) EnumAvailableSqlServers(String) EnumAvailableSqlServers(String)

Enumerates a list of available instances of SQL Server that are installed on the computer with the specified instance name.

EnumAvailableSqlServers() EnumAvailableSqlServers() EnumAvailableSqlServers()

Enumerates a list of available instances of SQL Server.

public:
 static System::Data::DataTable ^ EnumAvailableSqlServers();
public static System.Data.DataTable EnumAvailableSqlServers ();
Public Shared Function EnumAvailableSqlServers () As DataTable
Returns

A DataTable system object value that contains an enumerated list of information about the available instances of SQL Server. The following table describes the different columns of the returned DataTable:

Column
Data type
Description
Name
String The name of the instance of SQL Server.
Server
String The name of the server on which the instance of SQL Server is installed.
Instance
String The instance of SQL Server.
IsClustered
Boolean A Boolean value that is True if the instance is participating in failover clustering, or False if it is not.
Version
String The version of the instance of SQL Server.
IsLocal
Boolean A Boolean value that is True if the instance is local, or False if the instance is remote.

Examples

Handling SMO Events

Remarks

The computer that is running the instance SQL Server might not receive responses to the EnumAvailableSqlServers method in a timely manner. The returned list might not show all the available instances of SQL Server on the network. When you call the EnumAvailableSqlServers method in subsequent tries, more servers might become visible on the network.

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.

EnumAvailableSqlServers(Boolean) EnumAvailableSqlServers(Boolean) EnumAvailableSqlServers(Boolean)

Enumerates a list of local available instances of SQL Server.

public:
 static System::Data::DataTable ^ EnumAvailableSqlServers(bool localOnly);
public static System.Data.DataTable EnumAvailableSqlServers (bool localOnly);
Public Shared Function EnumAvailableSqlServers (localOnly As Boolean) As DataTable
Parameters
localOnly
Boolean Boolean Boolean

A Boolean value that specifies whether local instances are listed or all instances available on the network.

If True, only local instances are listed.

If False, all instances are listed.

Returns

A DataTable system object value that contains an enumerated list of information about the available instances of SQL Server. The table describes the different columns of the returned DataTable.

Column
Data type
Description
Name
String The name of the instance of SQL Server.
Server
String The name of the server on which the instance of SQL Server is installed.
Instance
String The instance of SQL Server.
IsClustered
Boolean A Boolean value that is True if the instance is participating in failover clustering, or False if it is not.
Version
String The version of the instance of SQL Server.
IsLocal
Boolean A Boolean value that is True if the instance is local, or False if the instance is remote.

Examples

Handling SMO Events

Remarks

The computer running the instance SQL Server might not receive responses to the EnumAvailableSqlServers method in a timely manner. The returned list might not show all the available instances of SQL Server on the network. When you call the EnumAvailableSqlServers method in subsequent tries, more servers might become visible on the network.

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.

EnumAvailableSqlServers(String) EnumAvailableSqlServers(String) EnumAvailableSqlServers(String)

Enumerates a list of available instances of SQL Server that are installed on the computer with the specified instance name.

public:
 static System::Data::DataTable ^ EnumAvailableSqlServers(System::String ^ name);
public static System.Data.DataTable EnumAvailableSqlServers (string name);
Public Shared Function EnumAvailableSqlServers (name As String) As DataTable
Parameters
name
String String String

A String value that specifies the name of the computer on which the instances of SQL Server are installed or a single instance of SQL Server.

Returns

A DataTable system object value that contains an enumerated list of information about the available instances of SQL Server on the specified computer.

If a single instance of SQL Server is specified in the name parameter, instead of a computer name, results are returned for the specified instance only. The table describes the different columns of the returned DataTable.

Column
Data type
Description
Name
String The name of the instance of SQL Server.
Server
String The name of the server on which the instance of SQL Server is installed.
Instance
String The instance of SQL Server.
IsClustered
Boolean A Boolean value that is True if the instance is participating in failover clustering, or False if it is not.
Version
String The version of the instance of SQL Server.
IsLocal
Boolean A Boolean value that is True if the instance is local, or False if the instance is remote.

Examples

Handling SMO Events

Remarks

The computer that is running the instance SQL Server might not receive responses to the EnumAvailableSqlServers method in a timely manner. The returned list might not show all the available instances of SQL Server on the network. When you call the EnumAvailableSqlServers method in subsequent tries, more servers might become visible on the network.

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.

Applies to