Friday, May 23, 2008

Detect SQL Server Instances in Network

If you want to detect all accessible instances of SQL Server, simply create a .NET project and add a COM reference to Microsoft SQLDMO

 

Now Open your code file and paste this code in a function...

 

Dim sqlServers As SQLDMO.NameList

Dim sqlServer As String

' Get a list of servers

sqlServers = New SQLDMO.Application().ListAvailableSQLServers

For Each sqlServer In sqlServers

Response.Write(sqlServer,"<br>")

Next

 

 

When you will call this function, list of all accessible SQL Server instances will be printed on screen.

:)

0 comments: