SQL instances of a remote server

2

The problem is the following, I would like to obtain a list of all the sql instances of a remote server, currently I have only been able to get the list locally using the following code fragment provided by Microsoft.

class Program {  
  static void Main()  
  {  
    // Retrieve the enumerator instance and then the data.  
    SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;  
    System.Data.DataTable table = instance.GetDataSources();  
    // Display the contents of the table.  
    DisplayData(table);  
    Console.WriteLine("Press any key to continue.");  
    Console.ReadKey();  
  }  
  private static void DisplayData(System.Data.DataTable table)  
  {  
    foreach (System.Data.DataRow row in table.Rows)  
    {  
      foreach (System.Data.DataColumn col in table.Columns)  
      {  
        Console.WriteLine("{0} = {1}", col.ColumnName, row[col]);  
      }  
      Console.WriteLine("============================");  
    }  
  }  
}

To do it remotely, how would it be?

    
asked by jld 11.09.2018 в 10:17
source

0 answers