This commit is contained in:
Przemyslaw Klys
2020-07-16 00:03:54 +02:00
parent c99c33d0fa
commit e514deca08
3 changed files with 147 additions and 53 deletions
+28 -16
View File
@@ -100,31 +100,43 @@
$Output['CategoriesFull'] = $CachedCategories
# Process Reporting
$Output['Reports'] = [ordered] @{}
foreach ($Report in $Type) {
$Category = $Script:GPODitionary[$Report]['Category']
$Settings = $Script:GPODitionary[$Report]['Settings']
$CategorizedGPO = $CachedCategories[$Category][$Settings]
foreach ($GPO in $CategorizedGPO) {
if (-not $Output['Reports'][$Report]) {
$Output['Reports'][$Report] = [System.Collections.Generic.List[PSCustomObject]]::new()
if ($CachedCategories.Count -gt 0) {
foreach ($Report in $Type) {
$Category = $Script:GPODitionary[$Report]['Category']
$Settings = $Script:GPODitionary[$Report]['Settings']
# Those are checks for making sure we have data to be even able to process it
if (-not $CachedCategories[$Category]) {
continue
}
if ($SingleObject) {
if ($Script:GPODitionary[$Report]['CodeSingle']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['CodeSingle']
$Output['Reports'][$Report].Add($TranslatedGpo)
if (-not $CachedCategories[$Category][$Settings]) {
continue
}
# Translation
$CategorizedGPO = $CachedCategories[$Category][$Settings]
foreach ($GPO in $CategorizedGPO) {
if (-not $Output['Reports'][$Report]) {
$Output['Reports'][$Report] = [System.Collections.Generic.List[PSCustomObject]]::new()
}
} else {
if ($Script:GPODitionary[$Report]['Code']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['Code']
$Output['Reports'][$Report].Add($TranslatedGpo)
$TranslatedGpo = $null
if ($SingleObject) {
if ($Script:GPODitionary[$Report]['CodeSingle']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['CodeSingle']
}
} else {
if ($Script:GPODitionary[$Report]['Code']) {
$TranslatedGpo = Invoke-Command -ScriptBlock $Script:GPODitionary[$Report]['Code']
}
}
foreach ($T in $TranslatedGpo) {
$Output['Reports'][$Report].Add($T)
}
}
}
}
return $Output
foreach ($GPO in $GPOs) {