PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
HOWTO: List SQL Servers on Local Machine
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
HOWTO: List SQL Servers on Local Machine
![]() |
HOWTO: List SQL Servers on Local Machine |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi All,
I need to retrieve a list of SQL servers that are running on a local machine. I have tried using: SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; System.Data.DataTable table = instance.GetDataSources(); but have found that it returns servers on the entire network not on the local machine. Is there some other C# API that can be used to get a list of SQL servers that are running on the local machine? Thanks in advance for any help, Scott |
|
|
|
#2 |
|
Guest
Posts: n/a
|
I have used these methods many times to demonstrate access to servers on the
local machine and anywhere else visible on the net. Are the local servers configured so as to make them "visible"? Is the SqlBrowser service running? Are the ports and protocols enabled? -- ____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ "Scott" <Scott@discussions.microsoft.com> wrote in message news:5B8FB955-666F-4848-8A64-216DF5C8CBC6@microsoft.com... > Hi All, > > I need to retrieve a list of SQL servers that are running on a local > machine. > > I have tried using: > SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; > System.Data.DataTable table = instance.GetDataSources(); > but have found that it returns servers on the entire network not on the > local machine. > > Is there some other C# API that can be used to get a list of SQL servers > that are running on the local machine? > > Thanks in advance for any help, > Scott |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Hi Bill,
Yes, the local servers are visible and SqlBroswer service is running. Not sure about ports and protocols. However the two servers I am intersted in(SQLEXPRESS and MSSQLSSERVER-MSDE) are visible SQL Server Configuration Manager. "William (Bill) Vaughn" wrote: > I have used these methods many times to demonstrate access to servers on the > local machine and anywhere else visible on the net. Are the local servers > configured so as to make them "visible"? Is the SqlBrowser service running? > Are the ports and protocols enabled? > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Did you run the SQL Server Surface Area Configuratoin tool?
-- ____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ "Scott" <Scott@discussions.microsoft.com> wrote in message news:A9219BF1-C1EA-44C6-AF25-70DC6EABAA63@microsoft.com... > Hi Bill, > > Yes, the local servers are visible and SqlBroswer service is running. > Not sure about ports and protocols. However the two servers I am intersted > in(SQLEXPRESS and MSSQLSSERVER-MSDE) are visible SQL Server Configuration > Manager. > > "William (Bill) Vaughn" wrote: > >> I have used these methods many times to demonstrate access to servers on >> the >> local machine and anywhere else visible on the net. Are the local servers >> configured so as to make them "visible"? Is the SqlBrowser service >> running? >> Are the ports and protocols enabled? >> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Bill, I think he is saying he is getting ALL servers. He just wants to
enumerate those on the local machine. He is getting these, plus the rest of the network, too Jeff "William (Bill) Vaughn" <billvaRemoveThis@nwlink.com> wrote in message news:uYBIpCYXGHA.3724@TK2MSFTNGP02.phx.gbl... > Did you run the SQL Server Surface Area Configuratoin tool? > > -- > ____________________________________ > William (Bill) Vaughn > Author, Mentor, Consultant > Microsoft MVP > INETA Speaker > www.betav.com/blog/billva > www.betav.com > Please reply only to the newsgroup so that others can benefit. > This posting is provided "AS IS" with no warranties, and confers no > rights. > __________________________________ > > "Scott" <Scott@discussions.microsoft.com> wrote in message > news:A9219BF1-C1EA-44C6-AF25-70DC6EABAA63@microsoft.com... >> Hi Bill, >> >> Yes, the local servers are visible and SqlBroswer service is running. >> Not sure about ports and protocols. However the two servers I am >> intersted >> in(SQLEXPRESS and MSSQLSSERVER-MSDE) are visible SQL Server Configuration >> Manager. >> >> "William (Bill) Vaughn" wrote: >> >>> I have used these methods many times to demonstrate access to servers on >>> the >>> local machine and anywhere else visible on the net. Are the local >>> servers >>> configured so as to make them "visible"? Is the SqlBrowser service >>> running? >>> Are the ports and protocols enabled? >>> > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
Jeff and Bill,
Yes, what I would like to be able to do is have initially a list of only the SQL servers that are local to the machine. Similar to the dialog the comes up when running Micorsoft SQL Server Management Studio: It's initial dropdown shows (which is very fast): MYMACHINENAME/SQLEXPRESS MYMACHINENAME <Browse for more...> Choosing "Browse for more..." then launches the search for all servers but is quite slow depending on the number of servers it searches through on the network. Note I was not seeing even my local machine in the list of all servers but this was due to some strange VPN problem. "Jeff Dillon" wrote: > Bill, I think he is saying he is getting ALL servers. He just wants to > enumerate those on the local machine. He is getting these, plus the rest of > the network, too > > Jeff |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Ah. In that case, filter the returned table using a DataView based on the
local machine name... -- ____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ "Scott" <Scott@discussions.microsoft.com> wrote in message news:CF0776D7-0F57-4A1F-9E77-67C175FDC9AF@microsoft.com... > Jeff and Bill, > > Yes, what I would like to be able to do is have initially a list of only > the > SQL servers that are local to the machine. > Similar to the dialog the comes up when running Micorsoft SQL Server > Management Studio: It's initial dropdown shows (which is very fast): > MYMACHINENAME/SQLEXPRESS > MYMACHINENAME > <Browse for more...> > Choosing "Browse for more..." then launches the search for all servers but > is quite slow depending on the number of servers it searches through on > the > network. > > Note I was not seeing even my local machine in the list of all servers but > this was due to some strange VPN problem. > > "Jeff Dillon" wrote: > >> Bill, I think he is saying he is getting ALL servers. He just wants to >> enumerate those on the local machine. He is getting these, plus the rest >> of >> the network, too >> >> Jeff |
|
|
|
#8 |
|
Guest
Posts: n/a
|
William (Bill) Vaughn wrote:
>Ah. In that case, filter the returned table using a DataView based on >the local machine name... Look it up in the registry? -- Thomas Due Posted with XanaNews version 1.18.1.3 "Victorious warriors win first and then go to war, while defeated warriors go to war first and then seek to win." -- Sun-tzu, The Art of War. Strategic Assessments |
|
|
|
#9 |
|
Guest
Posts: n/a
|
See the My and Application classes.
-- ____________________________________ William (Bill) Vaughn Author, Mentor, Consultant Microsoft MVP INETA Speaker www.betav.com/blog/billva www.betav.com Please reply only to the newsgroup so that others can benefit. This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________ "Thomas Due" <tdue@mail_remove_.dk> wrote in message news:uHwOWf3YGHA.1580@TK2MSFTNGP02.phx.gbl... > William (Bill) Vaughn wrote: > >>Ah. In that case, filter the returned table using a DataView based on >>the local machine name... > > Look it up in the registry? > > -- > Thomas Due > Posted with XanaNews version 1.18.1.3 > > "Victorious warriors win first and then go to war, while defeated > warriors go to war first and then seek to win." > -- Sun-tzu, The Art of War. Strategic Assessments |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

