Retrieving List of SQL Servers on a Network via SQL-DMOsqldmogetsqlserversIllustrates how to retrieve a list of SQL Server instances found on a local area network.C# .Net Fun - http://www.dotnetfun.com - Michael G.
:\Program Files\Microsoft SQL Server\\Tools\Binn
SQLDMO.ApplicationClass app = new SQLDMO.ApplicationClass();
try
{
SQLDMO.NameList names = app.ListAvailableSQLServers();
foreach (String strServer in names)
{
// do something the names here ...
}
}
catch (Exception err)
{
// SQL-DMO Error...
}
finally
{
app.Quit();
app = null;
}
]]>