Find sql database server instance and mdf file on LAN
how i can retreive all sql db server instance on
LAN and mdf for that instance (names and path)
which classes and namespaces I mast use?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Roei BarRank #1,271 · 1.4K reputationPosted Sep 15, 2009, 2:40 AM EDT
public void GetSQLInstances() { System.Data.Sql.SqlDataSourceEnumerator instance = System.Data.Sql.SqlDataSourceEnumerator.Instance; dataTable = instance.GetDataSources(); if (dataTable.Rows.Count > 0) { InstancesInformation(); } } } private void InstancesInformation() { string strList; foreach (System.Data.DataRow row in dataTable.Rows) { strList += row[0], row[1]; } }about getting their mdf file Location, thats not an option unless you are an admin if so you can use SQL SMO to obtain that data