Here is the PowerShell code snippet to find the port where the SQL server is listing:

 

$SQLPort = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceName\MSSQLServer\SuperSocketNetLib\Tcp").TcpPort
Write-Host "The SQl Server TCP/IP port is $SQLPort"


# HostPort is for the XML config files of Tomcat
$HostPort = $env:computername+':'+$SQlPort

Categories:

Comments are closed