|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 6:45 AM
Points: 961,
Visits: 795
|
|
Comments posted to this topic are about the item SQL Server Port Number Script
/* ----------------------------- */ Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Sunday, May 19, 2013 1:36 PM
Points: 887,
Visits: 2,062
|
|
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.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 6:45 AM
Points: 961,
Visits: 795
|
|
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!
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Today @ 10:25 AM
Points: 18,754,
Visits: 12,337
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 20, 2013 6:45 AM
Points: 961,
Visits: 795
|
|
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!
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 1:51 PM
Points: 1,801,
Visits: 257
|
|
RegOpenKeyEx() returned error 2, 'The system cannot find the file specified.' 
this is on named instance of sql 2008 on 64-bit 2008 server
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Today @ 2:09 AM
Points: 63,
Visits: 700
|
|
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.
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 1:51 PM
Points: 1,801,
Visits: 257
|
|
| Exactly, I was just wondering whether you know where ?
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Today @ 2:09 AM
Points: 63,
Visits: 700
|
|
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
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 1:51 PM
Points: 1,801,
Visits: 257
|
|
Excellent! Great job!
|
|
|
|