获取开源 GetNetStat 模块:
PS> Install-Module -Name GetNetStat -Scope CurrentUser
安装模块后,可以使用 Get-NetStat 新命令;
运行命令GetNetStat ,列出了所有打开的 HTTPS(端口 443)连接,并解析主机名:
PS> Get-NetStat -RemotePort 443 -State Established -Resolve | Select-Object -Property RemoteIp, Pid, PidName
RemoteIp PID PIDName
-------- --- -------
1drv.ms 9432 WINWORD
lb-140-82-113-26-iad.github.com 21588 chrome
1drv.ms 9432 WINWORD
1drv.ms 9432 WINWORD
51.103.5.186 5464 svchost
51.103.5.186 12752 OneDrive
52.113.206.137 13736 Teams
51.107.59.180 14484 pwsh