Skip to content

Commit

Permalink
fixes #4945
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Mar 18, 2019
1 parent dcda3dc commit ca8d7bd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions functions/Read-DbaBackupHeader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,23 @@ function Read-DbaBackupHeader {

foreach ($row in $dataTable) {
$row.BackupPath = $Path

$backupsize = $row.BackupSize
$null = $dataTable.Columns.Remove("BackupSize")
$null = $dataTable.Columns.Add("BackupSize", [dbasize])
if ($backupsize -isnot [dbnull]) {
$row.BackupSize = [dbasize]$backupsize
}

$cbackupsize = $row.CompressedBackupSize
$null = $dataTable.Columns.Remove("CompressedBackupSize")
if ($dataTable.Columns['CompressedBackupSize']) {
$null = $dataTable.Columns.Remove("CompressedBackupSize")
}
$null = $dataTable.Columns.Add("CompressedBackupSize", [dbasize])
if ($cbackupsize -isnot [dbnull]) {
$row.CompressedBackupSize = [dbasize]$cbackupsize
}

$restore.FileNumber = $row.Position
<# Select-Object does a quick and dirty conversion from datatable to PS object #>
$row.FileList = $restore.ReadFileList($server) | Select-Object *
Expand Down

0 comments on commit ca8d7bd

Please sign in to comment.