Get-NetUDPEndpoint - OwningProcess Missing for Remote Computers

Hi,

When I run Get-NetUDPEndpoint locally …

Get-NetUDPEndpoint -LocalAddress "0.0.0.0" | Select-Object LocalAddress,LocalPort,OwningProcess

… it returns the PID of he owning process.

But if I run the command against a remote computer using the parameter -CimSession, or via Invoke-Command …

New-CimSession -ComputerName RemoteComputer -Name RemoteCim
Get-NetUDPEndpoint -LocalAddress "0.0.0.0" -CimSession RemoteCim | Select-Object LocalAddress,LocalPort,OwningProcess

Invoke-Command -ComputerName RemoteComputer -ScriptBlock {Get-NetUDPEndpoint -LocalAddress "0.0.0.0"} | Select-Object LocalAddress,LocalPort,OwningProcess

… it doesn’t return the owning process.

Have I missed something out or is this an expected outcome?

Thanks.

Can’t duplicate. At first I thought you just needed to put your select inside the scriptblock on the invoke-command call, but both worked as is for me.

That got me thinking a little further and it turns out to be an O/S version issue. Lazy me only tested on one remote machine and assumed the worst.

Turns out Get-NetUDPEndpoint doesn’t return OwningProcess if its Windows 2012 R2. Works a treat for 2016 and 2019.

99% of our servers are 2016 and above and I had to select the odd one out. Grrrr.

Thanks @krzydoug.

Good to know, thanks for sharing!