FG
💻 Software

Powershell access a single value in a table

Fresh5 days ago
Mar 15, 202647025 views
Confidence Score0%
0%

Problem

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. If use format-table etc, I always…

Error Output

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

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

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Powershell access a single value in a table

Low Risk

Not sure if this helps but you can load the csv file into an array and then using indices access the individual rows and for each row you can use the column name to access the individual cell. Just change 'ColA' for the name of your column and remem…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment