Reputation: 291
I have something like this:
$outp = Get-Process | % {
[pscustomobject]@{
ID = $_.Id
ProcessName = $_.ProcessName
}
} | Format-Table -AutoSize
which results in $outp
like this:
ID ProcessName -- ----------- 6752 ApplicationFrameHost 8944 browser_broker
How do I access an individual row (or column for that matter) in $outp
?
Upvotes: 1
Views: 1010
Reputation: 1963
Better to use $outp = get-process | select ID, Processname
like Ansgar said and than you can access it by using $outp[row].ID
, like $outp[0].ID
will be the ID of first entry.
If you need to display it, use $outp | ft -autosize
.
Upvotes: 2