I need to show a list of detected SQL Server 2000 instances installed on a L
AN. I would like to know if anyone knows how to list the servers, similar t
o what Enterprise Manager does with its Server Registration Wizard.
ThanksHi,
From command prompt execute,
ISQL -L
Thanks
Hari
MCDBA
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:983A2E30-10E0-4E3A-BF35-AD0DA6FC7E7A@.microsoft.com...
> I need to show a list of detected SQL Server 2000 instances installed on a
LAN. I would like to know if anyone knows how to list the servers, similar
to what Enterprise Manager does with its Server Registration Wizard.
> Thanks|||Thanks,
Do you have a method that can be done programmatically, rather than from the
command prompt? I need to build this capability into an application for our
developers.
Mike|||SQLDMO
>--Original Message--
>Thanks,
>Do you have a method that can be done programmatically,
rather than from the command prompt? I need to build this
capability into an application for our developers.
>Mike
>.
>|||I believe Enterprise Manager uses the SQLBrowseConnect ODBC function to
enumerate the SQL Servers on a network.
Rand
This posting is provided "as is" with no warranties and confers no rights.|||Hi Mike
It would help a great deal if you can supply me with the programming
language that you want this done in.
Regards
Wimpie
"Mike" <anonymous@.discussions.microsoft.com> wrote in message
news:983A2E30-10E0-4E3A-BF35-AD0DA6FC7E7A@.microsoft.com...
> I need to show a list of detected SQL Server 2000 instances installed on a
LAN. I would like to know if anyone knows how to list the servers, similar
to what Enterprise Manager does with its Server Registration Wizard.
> Thanks|||Me again...
I include the source of one of my VB .Net projects that does this. The is
no need to include any SQL objects in the project since the software
emulates the SQLDMO object in broadcasting a request for identification on
the network.
Hope it helps
Wimpie
----
---
Public Structure ServerInfo
Friend ServerName As String
Friend InstanceName As String
Friend IsClustered As Boolean
Friend Version As String
Friend TCPPort As Long
Friend IPAddress As String
End Structure
Public Sub Start()
Dim objSQLServers() As ServerInfo = EnumSQLServer()
End Sub
Friend Function EnumSQLServer() As ServerInfo()
Dim objUDPClient As New System.Net.Sockets.UdpClient
Dim objRemoteIP As System.Net.IPEndPoint
Dim objAllServers() As ServerInfo
Dim bytData() As Byte = {2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0}
Dim bytReceived() As Byte
Dim strInfo() As String
Dim strHostHeaders() As String
Dim booDone As Boolean = False
Dim i As Long
Dim x As Int16
ReDim strHostHeaders(0)
objUDPClient.Send(bytData, 18, "255.255.255.255", "1434")
While booDone = False
Try
bytReceived = objUDPClient.Receive(objRemoteIP)
Catch
booDone = True
Exit While
End Try
If strHostHeaders(strHostHeaders.Length - 1) <> "" Then
ReDim Preserve strHostHeaders(strHostHeaders.Length)
End If
strHostHeaders(strHostHeaders.Length - 1) =
Mid(System.Text.ASCIIEncoding.ASCII.GetString(bytReceived), 4)
strHostHeaders(strHostHeaders.Length - 1) &= ";IPADDRESS;" &
objRemoteIP.Serialize.Item(4).ToString & "." &
objRemoteIP.Serialize.Item(5).ToString & "." &
objRemoteIP.Serialize.Item(6).ToString & "." &
objRemoteIP.Serialize.Item(7).ToString
If strHostHeaders.Length > 1 Then
If strHostHeaders(strHostHeaders.Length - 1) =
strHostHeaders(strHostHeaders.Length - 2) Then ReDim Preserve
strHostHeaders(strHostHeaders.Length - 2)
End If
End While
objUDPClient.Close()
objUDPClient = Nothing
ReDim objAllServers(strHostHeaders.Length - 1)
For i = 0 To strHostHeaders.Length - 1
strInfo = Split(strHostHeaders(i), ";")
For x = 0 To strInfo.Length - 1
Select Case LCase(strInfo(x))
Case "servername"
objAllServers(i).ServerName = strInfo(x + 1)
Case "instancename"
objAllServers(i).InstanceName = strInfo(x + 1)
Case "isclustered"
objAllServers(i).IsClustered = IIf(LCase(strInfo(x +
1)) = "no", False, True)
Case "version"
objAllServers(i).Version = strInfo(x + 1)
Case "tcp"
objAllServers(i).TCPPort = CLng(strInfo(x + 1))
Case "ipaddress"
objAllServers(i).IPAddress = strInfo(x + 1)
End Select
Next
Next
Return objAllServers
End Function
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment