How to Identify port number of SQL server

前端 未结 7 1531
天命终不由人
天命终不由人 2021-01-30 06:52

I Install SQL server in my system and I have to check on which port number SQL is working in my system

7条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 07:21

    PowerShell solution that shows all of the instances on the host as well as their incoming traffic addresses. The second bit might be helpful if all you know is the DNS:

    ForEach ($SQL_Proc in Get-Process | Select-Object -Property ProcessName, Id | Where-Object {$_.ProcessName -like "*SQL*"})
    {
        Get-NetTCPConnection | `
         Where-Object {$_.OwningProcess -eq $SQL_Proc.id} | `
          Select-Object -Property `
                                    @{Label ="Process_Name";e={$SQL_Proc.ProcessName}}, `
                                    @{Label ="Local_Address";e={$_.LocalAddress + ":" + $_.LocalPort }},  `
                                    @{Label ="Remote_Address";e={$_.RemoteAddress + ":" + $_.RemotePort}}, State | `
          Format-Table
    } 
    

提交回复
热议问题