add GB and TB

Hi guys please help me can any body make this on GB and TB please thanks.
$backups = get-vbrbackup
$allstorages = @()
foreach ($backup in $backups) {
foreach ($storage in $backup.getallstorages()) {
$allstorages += New-Object -TypeName psobject -Property @{
JobName=$backup.Name;
Time=$storage.CreationTime;
Path=$storage.Info.FilePath;
BackupSizeGB=$storage.Info.Stats.BackupSize/1GB;
DataSizeGB=$storage.Info.Stats.DataSize/1GB;
}
}
}
$allstorages = $allstorages | Sort-Object -Property JobName,Time
$allstorages | select -property Jobname,Time,Path,BackupSizeGB,DataSizeGB | Format-Table -AutoSize

I may not be clear on what you are after, but I am going to assume you mean turning this…

BackupSizeGB=$storage.Info.Stats.BackupSize/1GB;
DataSizeGB=$storage.Info.Stats.DataSize/1GB;

… into this…

BackupSizeGB=$storage.Info.Stats.BackupSize/1TB;
DataSizeGB=$storage.Info.Stats.DataSize/1TB;

The math approach is the same, but use and if/then to determine when the GB size hits the TB threshold. For example…

if(DataSizeGB -ge 1024){DataSizeGB=$storage.Info.Stats.DataSize/1TB}
if(BackupSizeGB -ge 1024){BackupSizeGB=$storage.Info.Stats.BackupSize/1TB}

… or have two columns, on in GB and the other in TB.

See this article:

'powershellmagazine.com/2013/05/20/converting-to-size-units-kb-mbgbtb-and-pb-without-using-powershell-multipliers'