Skip to content

Instantly share code, notes, and snippets.

@cuongitl
Created November 27, 2024 03:20
Show Gist options
  • Select an option

  • Save cuongitl/a7805a03c08dda5146285cc2b46e0a31 to your computer and use it in GitHub Desktop.

Select an option

Save cuongitl/a7805a03c08dda5146285cc2b46e0a31 to your computer and use it in GitHub Desktop.
Veeam: Powershell get Backup Repository Information: Returns a list of backup repositories.
# Veeam: Powershell get Backup Repository Information: Returns a list of backup repositories.
# Get-VBRBackupRepository | Format-List *
#Get-VBRBackupRepository |
# Select-Object Name, Id, Type, @{Name="Path";Expression={$_.Path.ToString()}}, Description |
# ConvertTo-Json -Depth 3
Get-VBRBackupRepository |
Select-Object Name,
Id,
@{Name="Type"; Expression={
$typeValue = $_.Type
# Check if the Type is an enum and get its string value
if ($typeValue -is [Enum]) {
$typeValue.ToString()
} elseif ($typeValue -is [int]) {
switch ($typeValue) {
0 { "LocalRepository" }
1 { "CloudRepository" }
2 { "NetworkRepository" }
3 { "BackupRepository" }
default { "Unknown" }
}
} else {
# If it's an unknown type
"Unknown ($typeValue)"
}
}},
@{Name="Path"; Expression={$_.Path.ToString()}},
Description |
ConvertTo-Json -Depth 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment