Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

SQL Server Port Number Script Expand / Collapse
Author
Message
Posted Thursday, April 29, 2010 3:45 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 19, 2013 9:06 AM
Points: 1,002, Visits: 883
Comments posted to this topic are about the item SQL Server Port Number Script

/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #912647
Posted Tuesday, May 04, 2010 3:46 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 7:39 AM
Points: 984, Visits: 2,188
Good script - Thank you.

But it only runs for the server I’m currently connected to. Did I misunderstand your sentence about iterating thru servers?

--Vadim.
Post #915704
Posted Tuesday, May 04, 2010 6:07 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 19, 2013 9:06 AM
Points: 1,002, Visits: 883
It will iterate through server's if you are using a multi-server query that is available in SSMS2008, otherwise it will show just the server that you are querying against.

/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #915754
Posted Tuesday, May 04, 2010 6:15 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 7:26 AM
Points: 20,455, Visits: 14,067
That is a nice script indeed. Thanks.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #915757
Posted Tuesday, May 04, 2010 6:29 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 19, 2013 9:06 AM
Points: 1,002, Visits: 883
The multi-server query is a great addition to SSMS, I remember just a couple of years ago when you would have had to RDP into 70 servers to get this type of information (or run a script like this on 70 servers). Now with the multi server query you can look for Builtin\Administrators on all production servers, change the sa password in one swoop, determine if tempDB is on a seperate drive, etc...

Now if Microsoft will just give us something like Oracle Data Guard and or Oracle RAC...


/* ----------------------------- */
Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

Post #915763
Posted Monday, May 10, 2010 1:26 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 10:47 AM
Points: 2,008, Visits: 263
RegOpenKeyEx() returned error 2, 'The system cannot find the file specified.'

this is on named instance of sql 2008 on 64-bit 2008 server
Post #919272
Posted Wednesday, May 26, 2010 4:55 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Yesterday @ 8:43 AM
Points: 63, Visits: 729
vlad-548036 (5/10/2010)
RegOpenKeyEx() returned error 2, 'The system cannot find the file specified.'

this is on named instance of sql 2008 on 64-bit 2008 server


This script only works on the default instance, as the registry entry for named instances are stored elsewhere.



Post #928109
Posted Wednesday, May 26, 2010 8:36 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 10:47 AM
Points: 2,008, Visits: 263
Exactly, I was just wondering whether you know where ?
Post #928327
Posted Wednesday, May 26, 2010 9:41 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Yesterday @ 8:43 AM
Points: 63, Visits: 729
vlad-548036 (5/26/2010)
Exactly, I was just wondering whether you know where ?


I meant to post this earlier. This works for me across my servers\instances.
It's just a slightly amended version of the original.


declare @Server as varchar(128)
declare @KeyToInterogate as varchar(200)
declare @Version as varchar (512)
declare @PortNumber as varchar(8)

set @Server = @@ServerName
set @Version = left(@@Version, 38)
set @KeyToInterogate = 'SOFTWARE\MICROSOFT\MSSQLSERVER\MSSQLSERVER\SUPERSOCKETNETLIB\TCP'

if charindex('\',@@ServerName) > 0
begin
set @KeyToInterogate = 'SOFTWARE\Microsoft\Microsoft SQL Server\'
set @KeyToInterogate = @KeyToInterogate + substring(@@ServerName,charindex('\',@@ServerName) + 1,len(@@ServerName) - charindex('\',@@ServerName))
set @KeyToInterogate = @KeyToInterogate + '\MSSQLServer\SuperSocketNetLib\Tcp'
end

exec xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = @KeyToInterogate,
@value_name = 'TcpPort',
@value = @PortNumber output

If @PortNumber <> '1433'
begin
print '*****server: ' + @server + ' is running on port ' + cast(@PortNumber as varchar) + '. Server is: ' + @Version
end
else print 'server: ' + @server + ' is running on port ' + cast(@PortNumber as varchar) + '. Server is: ' + @Version


Post #928395
Posted Wednesday, May 26, 2010 10:43 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 10:47 AM
Points: 2,008, Visits: 263
Excellent! Great job!
Post #928457
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse