Unexpected output from where-object

105 Views Asked by At

In PowerShell, this command:

Get-NetIPConfiguration | where-object {$_.IPv4Address.IPAddress -match '172.20'}

Is yielding this output:

InterfaceAlias       : Wi-Fi
InterfaceIndex       : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name      : Identifying...
IPv6Address          : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
                       1::1
IPv4Address          : 172.20.4.93
IPv6DefaultGateway   : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway   : 172.20.4.1
DNSServer            : fe80::be98:dfff:feff:4acd

InterfaceAlias       : Local Area Connection 3
InterfaceIndex       : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status    : Disconnected

Whereas I would only expect to see this output:

InterfaceAlias       : Wi-Fi
InterfaceIndex       : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name      : Unidentified network
IPv6Address          : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
                       1::1
IPv4Address          : 172.20.4.93
IPv6DefaultGateway   : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway   : 172.20.4.1
DNSServer            : fe80::be98:dfff:feff:4acd

This is the full output from Get-NetIPConfiguration:

InterfaceAlias       : VirtualBox Host-Only Network
InterfaceIndex       : 11
InterfaceDescription : VirtualBox Host-Only Ethernet Adapter
IPv4Address          : 169.254.249.136
IPv6DefaultGateway   :
IPv4DefaultGateway   :
DNSServer            : fec0:0:0:ffff::1
                       fec0:0:0:ffff::2
                       fec0:0:0:ffff::3

InterfaceAlias       : Local Area Connection
InterfaceIndex       : 18
InterfaceDescription : TAP-Windows Adapter V9
NetProfile.Name      : somerandomcompany.com
IPv4Address          : 10.251.10.13
IPv6DefaultGateway   :
IPv4DefaultGateway   :
DNSServer            : 10.255.0.9
                       10.255.0.8

InterfaceAlias       : Wi-Fi
InterfaceIndex       : 24
InterfaceDescription : Intel(R) Wi-Fi 6 AX201 160MHz
NetProfile.Name      : PS-118 Guest
IPv6Address          : 2601:19b:c00:15c3:d80:ee8c:3679:1fe5
                       1::1
IPv4Address          : 192.168.0.208
IPv6DefaultGateway   : fe80::be98:dfff:feff:4acd
IPv4DefaultGateway   : 192.168.0.1
DNSServer            : fe80::be98:dfff:feff:4acd
                       fe80::be98:dfff:feff:4acd
                       192.168.0.1

InterfaceAlias       : Bluetooth Network Connection
InterfaceIndex       : 9
InterfaceDescription : Bluetooth Device (Personal Area Network)
NetAdapter.Status    : Disconnected

InterfaceAlias       : Local Area Connection 3
InterfaceIndex       : 22
InterfaceDescription : TAP-Windows Adapter V9 #3
NetAdapter.Status    : Disconnected

InterfaceAlias       : Local Area Connection 2
InterfaceIndex       : 27
InterfaceDescription : TAP-Windows Adapter V9 #2
NetAdapter.Status    : Disconnected

InterfaceAlias       : OpenVPN Wintun
InterfaceIndex       : 25
InterfaceDescription : Wintun Userspace Tunnel
NetAdapter.Status    : Disconnected

I get the same result with PowerShell 7.2.5 and PowerShell 5.1.19041.1682, on Windows 10

Please let me know if I can provide any other information, and thank you for any help!

0

There are 0 best solutions below