31 October,2012 by Tom Collins
I developed some scripts to gather information for a Disaster Recovery preparation. Finding and storing the port number used by a SQL Server Instance was a requirement. The SQL Servers are 2012 , which allowed the sys.dm_server_registry DMV to be used. To find earlier versions TCP port information , it is necessary to investigate the Windows registry keys
The sys.dm_server_registry returns SQL Server Instance specific Windows registry details. One of the rows is “TcpPort”.
The Powershell Invoke-sqlcmd cmdlet is useful when using T-SQL or XQuery and sqlcmd is the preferred method of connecting to the SQL Server.
Invoke-sqlcmd -ServerInstance "MyServer\MyInstance" -Query "select value_data AS Port from sys.dm_server_registry WHERE value_name = 'TcpPort'"
TCP Chimney offload - SQL Server DBA
Error 26073 and TCP connection closed - SQL Server DBA
Powershell and Disaster Recovery preparation – T-SQL
Difference between TCP and UDP network protocols
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |