Powershell access a single value in a table

Posted by falkaholic on Super User See other posts from Super User or by falkaholic
Published on 2009-11-24T23:42:59Z Indexed on 2010/04/18 7:03 UTC
Read the original article Hit count: 212

Filed under:

this should be a really easy one but i can't seem to find an easy way.

For example, in powershell and am using a CSV file, which is then used to look up some configuration data based on an ID. Here is what I have now, it works, but there has got to be a better way.

$configList = import-csv "C:\myconfig.csv"
$id = "5001"

$configList | where-object {$_.id -eq $id} | foreach-object{ $configData = $_.configData}

If use format-table etc, I always get the column header, which I would then have to cut off.

Again, this has got to be really easy and this isn't a show stopper. But there has to be a better way to get just the data out of a table without the column header.

© Super User or respective owner

Related posts about powershell