NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform.
You will still be able to view content, but posting and replying will be temporarily disabled.
To learn more, please review the information in this blog post.

Microsoft Virtualization Discussions

Size of values when i export CSV powershell

anthony69300
2,607 Views

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

JGPSHNTAP
2,600 Views

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"}}

Public