# add GB and TB

**URL:** <https://forums.powershell.org/t/add-gb-and-tb/11137>\
**Category:** PowerShell Help\
**Created:** [August 14, 2018, 4:53pm UTC](https://forums.powershell.org/t/add-gb-and-tb/11137 "2018-08-14T16:53:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [August 14, 2018, 4:53pm UTC](https://forums.powershell.org/t/add-gb-and-tb/11137/1 "2018-08-14T16:53:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![postanote](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@postanote](https://forums.powershell.org/u/postanote)\
**Post date:** [August 14, 2018, 6:55pm UTC](https://forums.powershell.org/t/add-gb-and-tb/11137/2 "2018-08-14T18:55:24Z")

</div>

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'

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:34pm UTC](https://forums.powershell.org/t/add-gb-and-tb/11137/3 "2024-05-16T20:34:33Z")

</div>

Closed on May 16, 2024, 8:34pm UTC


