check ports being used code example
Example 1: see what ports are in use
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
Example 2: cmd listening ports
C:\> netstat -a -b
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
C:\> netstat -a -b