How to find port using Get-DbaTcpPort How to find whether the port used by SQL Server is static or dynamic using Get-DbaTcpPort dbatools command?

Below command doesn't show whether it's static/dynamic:

Get-DbaTcpPort -sqlinstance TEST


And below one shows too many rows:

 Get-DbaTcpPort -sqlinstance TEST -ALL
As you already mentioned below command should work

 Get-DbaTcpPort -SqlInstance ComputerName\InstanceName -All



  -All 
  
  If this switch is enabled, an object with server name, IPAddress (ipv4
  and ipv6), port and static ($true/$false) for one or more SQL
  Servers is returned.


Documentation on Get-DbaTcpPort -All switch

This can be validated on the github code as well.

If you want specific port info for the connections using ipv4 then you could run:

$ipV4 = Test-Connection -ComputerName ComputerName -Count 1  | Select IPV4Address  
Get-DbaTcpPort -SqlInstance ComputerName\InstanceName -All |  Where-Object {( $_.IPAddress -eq $ipV4.IPV4Address )}


If you then want specific columns such as port number and if it is static, you could  add select-object port, Static

$ipV4 = Test-Connection -ComputerName ComputerName -Count 1  | Select IPV4Address
Get-DbaTcpPort -SqlInstance ComputerName\InstanceName -All |  Where-Object {( $_.IPAddress -eq $ipV4.IPV4Address )}  | select-object port, Static




If you want specific port info for the connections using ipv6

$ipV6 = Test-Connection -ComputerName ComputerName -Count 1  | Select IPV6Address
Get-DbaTcpPort -SqlInstance ComputerName\InstanceName -All |  Where-Object {( $_.IPAddress -eq $ipV6.IPV6Address )}


If you are on  an older version of dbatools
 then the -detailed flag is used instead of 

-All