We help IT Professionals succeed at work.
Get Started

Powershell - NetworkInfos - Expanded Properties Filter

Lionstone asked
Last Modified: 2017-04-12
With powershell at the end I'd like to have a value like
Adapter, IPv4Address, MAC Address

I've got know the idea to get that with:
Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration

Open in new window

Wich will give me multiple unneeded adapters. So I'd like to filter these on the ones which have at least one addresses.
Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null }

Open in new window

And now I've got it mostly correct but I have entries like that:
DHCPEnabled      : True
IPAddress        : {, fe80::30e7:9436:7ca:136c}
DefaultIPGateway : 
DNSDomain        : 
ServiceName      : VMSMP
Description      : Hyper-V Virtual Ethernet Adapter
Index            : 5

DHCPEnabled      : True
IPAddress        : {, fe80::4889:c466:5428:5068}
DefaultIPGateway : {}
DNSDomain        : company.cc
ServiceName      : VMSMP
Description      : Hyper-V-Adapter - virtuelles Ethernet #2
Index            : 6

Open in new window

So I'd like to filter the unwanted 169 configured adapter. Because with this way I think I'm able to find and list all valid configured adapters (LAN, Wifi, USB Connected Adapter) in different networks or
Get-WmiObject -ComputerName $Computer Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -notlike "*169.254*" }

Open in new window

But this doesn't work, because notlike seems not working on an array.
Watch Question
Most Valuable Expert 2019
Most Valuable Expert 2018
This problem has been solved!
Unlock 2 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE