This commit is contained in:
Przemyslaw Klys
2020-06-27 20:57:06 +02:00
parent 7cff95cc81
commit 27bd83eaba
12 changed files with 175 additions and 28 deletions
+25 -13
View File
@@ -21,6 +21,11 @@
'Account'
'SystemServices'
),
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[switch] $NoTranslation,
[Parameter(ParameterSetName = 'Default')]
[Parameter(ParameterSetName = 'Local')]
[string] $Splitter = [System.Environment]::NewLine,
@@ -78,16 +83,6 @@
}
#>
$GPODitionary = @{
'SecuritySettings' = @{
Name = 'Security Settings'
Translate = [ordered] @{
}
}
}
#$GPOStoredTypes = Get-XMLGPOTypes -GPOOutput $GPOOutput.GPO
@@ -101,7 +96,6 @@
}
$Output["$($D.GpoCategory)"]["$($D.GpoSettings)"].Add($D)
}
<#
continue
@@ -161,5 +155,23 @@
}
#>
}
$Output
}
if ($NoTranslation) {
$Output
} else {
$TranslatedOutput = [ordered] @{}
foreach ($Category in $Script:GPODitionary.Keys) {
if (-not $TranslatedOutput[$Category]) {
$TranslatedOutput[$Category] = [ordered] @{}
}
foreach ($Setting in $Script:GPODitionary[$Category].Keys) {
if (-not $TranslatedOutput[$Category][$Setting]) {
$TranslatedOutput[$Category][$Setting] = [ordered] @{}
}
$TranslatedOutput[$Category][$Setting] = Invoke-GPOTranslation -InputData $Output -Category $Category -Settings $Setting
}
}
$TranslatedOutput
}
}
#Select-Properties -AllProperties -Objects ($Output.SecuritySettings.SecurityOptions | Where-Object { $_.Display -ne $null })
+22
View File
@@ -0,0 +1,22 @@
function Select-GPOTranslation {
[cmdletbInding()]
param(
[Parameter(ValueFromPipeline)][System.Collections.IDictionary] $InputObject,
[string] $Category,
[string] $Settings
)
$Important = [ordered] @{}
$AllProperties = Select-Properties -AllProperties -Objects $InputObject.$Category.$Settings
$MissingProperties = $AllProperties | Where-Object { $_ -notin 'DisplayName', 'DomainName', 'GUID', 'Linked', 'LinksCount', 'Links', 'GPOType', 'GPOCategory', 'GPOSettings' }
$Types = foreach ($Property in $MissingProperties) {
($InputObject.$Category.$Settings | Where-Object { $null -ne $_.$Property }).$Property | ForEach-Object {
($_ | Get-Member -MemberType Properties) | Where-Object { $_.Name -notin 'Length' }
}
}
$Important['AllProperties'] = $AllProperties
$Important['MissingProperties'] = $MissingProperties
$Important['Types'] = $Types | Select-Object -Unique
$Important['Data'] = $InputObject.$Category.$Settings
$Important
}