The Import-CSV cmdlet in PowerShell is incredibly useful. You can take any CSV file and pump objects to the pipeline. The cmdlet uses the CSV header as properties for the custom object. PS S:\> import-csv .\testdata.csv Date : 1/18/2012 6:45:30 AM Name : Data_1 Service : ALG Key : 1 Size : 25 Date :…
Tag: Where-Object
Simple Where Filters
The comment about how awkward it is in PowerShell to filter out folders with Get-ChidlItem, or its alias dir, came up the other day on Twitter. I’ll be the first to admit that running a DIR command and wanting to skip folders, or perhaps you only want top level folders, is more cumbersome than we…
Filtering Empty Values in PowerShell
I saw this tip today and wanted to leave a comment but couldn’t see how. So I thought I’d post my comments here. This is actually a question I see often and there are better ways to write this kind of code. The posted tip used an example where you wanted to find processes where…
Get Properties with Values
One of my nuisance issues when using WMI with Windows PowerShell, is that when looking at all properties I have to wade though many that have no value. I’d prefer to only view properties that have a populated value. Here’s one way.