Basically I have a firewall blocking everything except what rules I add. I have an app which has no kb or documentation on what it needs to connect to. Wrote simple scripts to watch netstat given a process ID. This is slow. Wanted to use powershell's Get-NetTCPConnection to dump RemoteIP & Port from a given process name or a list of process names. Found some code here
Get-NetTCPConnection| Select LocalAddress, LocalPort, RemoteAddress, RemotePort, State, OwningProcess , @{n="ProcessName";e={(Get-Process -Id $_.OwningProcess).ProcessName}} , @{n="UserName";e={(Get-Process -Id $_.OwningProcess -IncludeUserName).UserName}}| Where {$_.State -eq"Established"} |FT -autosize -Force
but it shows established connections which I don't have yet. Instead of State I am hoping to dump any state on ProcessName but so far it has errored out. Any guidance or links that might help?