Microsoft Virtualization Discussions

Highlighted

Size of values when i export CSV powershell

Hello,

 

i need to see the size of all snapshot, on all volumes.

I usthis command in powershell cli :

 

 Get-NaVol vol* | Get-NaSnapshot | select TargetName,Name,Created,Total,CumulativeTotal,Dependency | ft -AutoSize

 

The output is good and in GB size for values Total and CumulativeTotal.

 

I try this command to export in CSV :

 

 Get-NaVol vol* | Get-NaSnapshot | select TargetName,Name,Created,Total,CumulativeTotal,Dependency | export-csv <mypath>

 

But when i try to export the output in CSV, the value of Total and CumulativeTotal appears in byte in my CSV file.

Someone can help me ?

 

Thank you

 

Thank you

1 REPLY 1

Re: Size of values when i export CSV powershell

you need to use custom select statements with convertto-formattednumber cmdlet or .net [math]:: functions

 

select @{n='size';e={convertto-formattednumber $_.total datasize "0.0"}}

Forums