LucD
Leadership
Leadership

You could use the Where method on the $bigList variable.

Something like this.

I forced an array (although not really needed) should there be only 1 row passing the Where-clause.

$smallList = @($bigList.Where({$_.PowerState -match 'PoweredOff' -and $_.Status -match 'Decommissioned'}))

$smallList | Export-Csv -Path c:\Temp\smallList.csv


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos