view all ports in use code example
Example 1: how to check for open ports in windows
netstat -an
Example 2: see what ports are in use
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess
netstat -an
Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess