Repositories.psm1
function Get-RepositoryDetails { param( [string]$Repository, [string]$Type = "WinLocal", $Processing = 'out' ) Begin { if ( $Repository -eq 'all' -or $Repository -eq '*' -or $Repository -eq $null ) { $Repository = '*' } if ( $Processing -notin @('out', 'send', 'raw') ) { $Processing = 'out' } } Process { if ($Type -eq "Extent") { $repos = Get-VBRBackupRepository -Name $Repository -ScaleOut } else { $repos = Get-VBRBackupRepository -Name $Repository } $repos | ForEach-Object { $_ } } } function Get-DiscoverRepositories { <# .SYNOPSIS .DESCRIPTION .PARAMETER Types .EXAMPLE #> param( $Types = '*' ) Begin { if ( $Types -eq 'all' -or $Types -eq '*' -or $Types -eq $null ) { $Types = @( 'local', 'scaleout' ) } } Process { $data = @() $Types | ForEach-Object { switch ( $_ ) { 'local' { $localReps = Get-VBRBackupRepository $localReps | foreach { $data += @{ "{#REPID}" = $_.Id "{#REPNAME}" = $_.Name "{#REPTYPE}" = $_.Type.ToString() } } } 'scaleout' { $soReps = Get-VBRBackupRepository -ScaleOut $soReps | foreach { $data += @{ "{#REPID}" = $_.Id "{#REPNAME}" = $_.Name "{#REPTYPE}" = "ScaleOut" } $_.Extent | foreach { $data += @{ "{#REPID}" = $_.Id "{#REPNAME}" = $_.Name "{#REPTYPE}" = "Extent" } } } } default { Write-Output 'Not Found' } } } $json = @{ "data" = $data } $json = $json | ConvertTo-Json -Compress Write-Output $json } } |