Remove Empty Entries

by Jul 22, 2010

One little known fact is that Where-Object is a cool and simple way of removing empty objects. Let's say you want to list all network adapters that have an IP address. You can simply add Where-Object and specify the object property that needs to have content:

Get-WmiObjectWin32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress }

Twitter This Tip! ReTweet this Tip!