SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to list all the instances and the port they are listening


How to list all the instances and the port they are listening

Author
Message
Sakthivel Chidambaram
Sakthivel Chidambaram
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2245 Visits: 838
Hi,
We have a requirement. One of our application called Discoverer will scan through the network and list the inventory of SQL Servers. But the problem is it has only option to enter the port for scanning and no option to type instance.

so if we give port as 1433 and scan the network, it misses the servers which don't have
1) Default Instance.
2) Dynamic Port is used.
3) If Instance/Server is listening in different port.

Can someone guide me on this please? Any idea to discover the list of instance and which port they listen when we specify the hostname or just specify the IP Range..? Hehe

Regards,
Sakthi
My Blog -> http://www.sqlserverdba.co.cc
Sakthivel Chidambaram
Sakthivel Chidambaram
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2245 Visits: 838
Or is there any T-SQL Query to find on which port a particular instance is running? I checked in sysrpocessed for one SPID it shows which protocol it has used to connect (TCP/IP or Named..) but it does not show which is the port used...

Regards,
Sakthi
My Blog -> http://www.sqlserverdba.co.cc
Perry Whittle
Perry Whittle
SSC Guru
SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)SSC Guru (91K reputation)

Group: General Forum Members
Points: 91164 Visits: 17960
done this already, use xp_regread to read the values from the registry and output

-----------------------------------------------------------------------------------------------------------

"Ya can't make an omelette without breaking just a few eggs" ;-)
K. Brian Kelley
K. Brian Kelley
Keeper of the Duck
Keeper of the Duck (39K reputation)

Group: Moderators
Points: 39110 Visits: 1917
You want to use SQLPing. Have a domain admin run it.

SQLSecurity.com Free Tools

The registry option only works if you know to connect to the SQL Server. SQLPing will use all known means of identifying SQL Servers, including those which are uninstalled but not running at the time.

K. Brian Kelley
@‌kbriankelley
Sakthivel Chidambaram
Sakthivel Chidambaram
SSCrazy
SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)SSCrazy (2.2K reputation)

Group: General Forum Members
Points: 2245 Visits: 838
Hi Brian Kelley,
Thank you so much for your reply! Just Y'day i got this site through googling... and found that application is really usefull... Anyways thank you so much for your help!!! Smile

Regards,
Sakthi
My Blog -> http://www.sqlserverdba.co.cc
pg53
pg53
SSC-Addicted
SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)SSC-Addicted (425 reputation)

Group: General Forum Members
Points: 425 Visits: 253
Hi
Code to do this in VB. (I think this came from a help file somewhere)

Function FindServers() As DataTable
Dim instance As System.Data.Sql.SqlDataSourceEnumerator = System.Data.Sql.SqlDataSourceEnumerator.Instance
Dim dataTable As System.Data.DataTable = instance.GetDataSources()
Return dataTable

End Function

HTH

pg
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search