All,
I'm learning PS and struggle on formatting when using -expandproperty. I need assistance or guidance please. I am trying to Export-Csv below information. If you noticed the Hostname1 and Hostname2 have different "Key" and "Value" . I want to export it to csv but it comes out different than what I expected.
above syntax comes out like this.
Name Serial Model Key Value
---- ------ ----- --- -----
Hostname1 ABC1902KDXU BMWM3 EOL 12/31/2021
Hostname1 ABC1902KDXU BMWM3 InService 8/1/2019
Hostname1 ABC1902KDXU BMWM3 Depreciated 1/1/2025
Hostname1 ABC1902KDXU BMWM3 EOS 3/28/2021
Hostname2 EFG2023J6HF BMWM3 EOS 3/28/2021
Hostname2 EFG2023J6HF BMWM3 EOL 12/31/2021
How do I get it to export this format below?
I have been trying to look around the web and no luck for me. I've tried below but again no luck
Add-Member -Type Noteproperty
Format-Table