I'm building a report about SMART metrics (SSD storage wear status):
Get-PhysicalDisk | %{
$s = $_ | Get-StorageReliabilityCounter;
[PSCustomObject]@{
Model = $_.Model;
BusType = $_.BusType;
MediaType = $_.MediaType;
SizeGB = [Int]($_.Size/1e9);
LogicalSectorSize = $_.LogicalSectorSize;
PhysicalSectorSize = $_.PhysicalSectorSize;
PowerOnHours = $s.PowerOnHours;
Temperature = $s.Temperature;
TemperatureMax = $s.TemperatureMax;
Wear = $s.Wear
}
}
I'd like to shorten an expression by just taking few properties from a parent into a child result of a pipe... Like adding a Model name & Size from Get-PhysicalDisk into subsequent Get-StorageReliabilityCounter without verbose syntax.
How can I do this?