0

I am executing the below line of code and need to convert the Size Column from bytes to TB.

"<style>table, th, td {border: 1px solid;}</style>"
Get-PhysicalDisk -Manufacturer PureStorage | ConvertTo-Html -Property "FriendlyName", FirmwareVersion, PhysicalLocation, OperationalStatus, HealthStatus, Size -Head $Style | Out-File D:\Array.htm

Current output

enter image description here

Desire out put to display Size Column in TB.

Size/102410241024*1024 . Would like to round of to two decimal places.

Any help will be greatly appreciated.

SQL Novice
  • 193
  • 8
  • Thanks Dough, that will work. How do I point my Column "Size" to that function so it does the conversion? – SQL Novice Apr 08 '21 at 19:12
  • You can use this `Get-PhysicalDisk|select @{n='Size (TB)';e={[math]::Round($_.size/1tb,2)}}`. Add all the column names there too. You can also save `Get-PhysicalDisk` to a variable and cast a `PSCustomObject` out (I like this better). – Santiago Squarzon Apr 08 '21 at 19:15
  • Thanks Santiago, the size column is not getting displayed. Did I miss anything? ````Get-PhysicalDisk -Manufacturer PureStorage | ConvertTo-Html -Property FriendlyName, FirmwareVersion, PhysicalLocation, OperationalStatus, HealthStatus, select @{n='Size (TB)';e={[math]::Round($_.size/1tb,2)}} -Head $Style | Out-File D:\Array.htm```` – SQL Novice Apr 08 '21 at 19:24
  • 1
    Like this: `Get-PhysicalDisk -Manufacturer PureStorage | Select FriendlyName, FirmwareVersion, PhysicalLocation, OperationalStatus, HealthStatus, @{n='Size (TB)';e={[math]::Round($_.size/1tb,2)}} | ConvertTo-Html -Head $style | Out-File D:\Array.htm` – Santiago Squarzon Apr 08 '21 at 19:27
  • Thank you Santiago, that worked. – SQL Novice Apr 08 '21 at 19:45

0 Answers0