Private/ReportsUtil.ps1
$global:NameDelimiter = " " function Get-ConfigReportsFromTenant($Tenant) { return "$env:ProgramData\$TenantPrefix\$Tenant\Config\MigrationReports\" } function Get-GlobalReportPath() { return "$env:ProgramData\$TenantPrefix\MigrationReports\" } function Get-GlobalReportList() { $path = Get-GlobalReportPath Get-ReportList $path } function Get-GlobalReport($Report) { $storePath = Get-GlobalReportPath Get-Report $storePath $Report } function Get-ConfigReportList($Tenant) { $path = Get-ConfigReportsFromTenant $Tenant Get-ReportList $path } function Get-ConfigReport($Tenant, $Report) { $storePath = Get-ConfigReportsFromTenant $Tenant Get-Report $storePath $Report } function Get-ReportList($path) { Get-ChildItem $path -Filter *.json | format-table -property @{n="Report";e={$_.basename}} } function Get-Report($storePath, $Report) { $path = $storePath + $Report + ".json" Write-Verbose "Reading $path" if ([System.IO.File]::Exists($path)) { $json = [system.IO.File]::ReadAllText($path) $info = $json | ConvertFrom-Json Write-Output $info } else { Write-Output "$Report does not exist" } } |