Syphirint Syphirint - 4 months ago 21
PowerShell Question

Object manipulation in PowerShell

Is there a way to manipulate the content of the

Object
so that the output shows the applications present on DESKTOP A?

$DB_struct = Import-Csv -Path $path
$DB_struct =

bundle app
DESKTOP A A
DESKTOP A B
DESKTOP A C
DESKTOP A D
DESKTOP B E
DESKTOP B F
DESKTOP B G
DESKTOP B H
DESKTOP C I
DESKTOP C J
DESKTOP C K
DESKTOP C L


EDIT: Changed
Export-Csv
to
Import-Csv
.

Answer

I'm assuming you mean Import-Csv and not Export-Csv.

$DB_struct | Where-Object { $_.bundle -eq 'DESKTOP A' } | Select-Object -Property app

Although, depending on what you're doing, you might need:

$DB_struct | Where-Object { $_.bundle -eq 'DESKTOP A' } | Select-Object -ExpandProperty app