mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-08 18:03:13 +00:00
Update
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
function Get-XMLOutput {
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[PSCustomObject] $GPO,
|
||||
[System.Xml.XmlElement[]] $GPOOutput,
|
||||
[string] $Splitter,
|
||||
[switch] $FullObjects
|
||||
)
|
||||
$LinksInformation = Get-LinksFromXML -GPOOutput $GPOOutput -Splitter $Splitter -FullObjects:$FullObjects
|
||||
foreach ($GpoType in @('User', 'Computer')) {
|
||||
if ($GPOOutput.$GpoType.ExtensionData.Extension) {
|
||||
foreach ($ExtensionType in $GPOOutput.$GpoType.ExtensionData.Extension) {
|
||||
# It's possible that one of the ExtensionType records has value null. Weird but happend.
|
||||
if ($ExtensionType) {
|
||||
$GPOSettingTypeSplit = ($ExtensionType.type -split ':')
|
||||
try {
|
||||
$KeysToLoop = $ExtensionType | Get-Member -MemberType Properties -ErrorAction Stop | Where-Object { $_.Name -notin 'type', $GPOSettingTypeSplit[0] -and $_.Name -notin @('Blocked') }
|
||||
} catch {
|
||||
Write-Warning "Get-XMLStandard - things went sideways $($_.Exception.Message)"
|
||||
continue
|
||||
}
|
||||
foreach ($GpoSettings in $KeysToLoop.Name) {
|
||||
$Template = [ordered] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
GpoType = $GpoType
|
||||
GpoCategory = $GPOSettingTypeSplit[1]
|
||||
GpoSettings = $GpoSettings
|
||||
}
|
||||
[PSCustomObject] $Template
|
||||
}
|
||||
continue
|
||||
|
||||
foreach ($GpoSettings in $KeysToLoop.Name) {
|
||||
foreach ($Key in $ExtensionType.$GpoSettings) {
|
||||
$Template = [ordered] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
GpoType = $GpoType
|
||||
GpoCategory = $GPOSettingTypeSplit[1]
|
||||
GpoSettings = $GpoSettings
|
||||
}
|
||||
try {
|
||||
$Properties = ($Key | Get-Member -MemberType Properties -ErrorAction Stop).Name
|
||||
} catch {
|
||||
Write-Warning "Get-XMLStandard - things went sideways 1 $($_.Exception.Message)"
|
||||
$Properties = $null
|
||||
}
|
||||
foreach ($Property in $Properties) {
|
||||
$Template["$Property"] = $Key.$Property
|
||||
}
|
||||
$Template['Linked'] = $LinksInformation.Linked
|
||||
$Template['LinksCount'] = $LinksInformation.LinksCount
|
||||
$Template['Links'] = $LinksInformation.Links
|
||||
<#
|
||||
$Template['IncludeComments'] = $GPOOutput.IncludeComments # : true #: true
|
||||
$Template['CreatedTime'] = $GPOOutput.CreatedTime # : 2020-06-17T11:23:22 #: 2020-06-17T11:23:22
|
||||
$Template['ModifiedTime'] = $GPOOutput.ModifiedTime # : 2020-06-28T15:49:52 #: 2020-06-28T15:49:52
|
||||
$Template['ReadTime'] = $GPOOutput.ReadTime # : 2020-06-28T16:14:09.2209011Z #: 2020-06-28T16:14:09.2209011Z
|
||||
$Template['SecurityDescriptor'] = $GPOOutput.SecurityDescriptor # : SecurityDescriptor #: SecurityDescriptor
|
||||
$Template['FilterDataAvailable'] = $GPOOutput.FilterDataAvailable # : true #: true
|
||||
#>
|
||||
[PSCustomObject] $Template
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,39 +50,40 @@
|
||||
ConvertTo-XMLEventLog -GPO $GPO
|
||||
}
|
||||
}
|
||||
<#
|
||||
LocalUsersAndGroups = [ordered] @{
|
||||
Category = 'LugsSettings'
|
||||
Settings = 'LocalUsersAndGroups'
|
||||
Code = {
|
||||
|
||||
LocalUsersAndGroups = [ordered] @{
|
||||
Category = 'LugsSettings'
|
||||
Settings = 'LocalUsersAndGroups'
|
||||
Code = {
|
||||
#ConvertTo-LocalUserAndGroups -GPOList $GPOList
|
||||
ConvertTo-XMLLocalUserAndGroups -GPO $GPO
|
||||
}
|
||||
}
|
||||
#>
|
||||
<#
|
||||
Policies = @{
|
||||
Category = 'RegistrySettings'
|
||||
Settings = 'Policy'
|
||||
Code = {
|
||||
ConvertTo-Policies -GPOList $GPOList
|
||||
CodeSingle = {
|
||||
#ConvertTo-EventLog -GPOList $GPOList
|
||||
ConvertTo-XMLLocalUserAndGroups -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
RegistrySettings = [ordered] @{
|
||||
Category = 'RegistrySettings'
|
||||
Settings = 'RegistrySettings'
|
||||
Code = {
|
||||
ConvertTo-RegistrySettings -GPOList $GPOList
|
||||
|
||||
Policies = @{
|
||||
Category = 'RegistrySettings'
|
||||
Settings = 'Policy'
|
||||
Code = {
|
||||
ConvertTo-XMLPolicies -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
ConvertTo-XMLPolicies -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
RegistrySettingsCollection = [ordered] @{
|
||||
Category = 'RegistrySettings'
|
||||
Settings = 'RegistrySettings'
|
||||
Code = {
|
||||
ConvertTo-RegistrySettingsCollection -GPOList $GPOList
|
||||
RegistrySettings = [ordered] @{
|
||||
Category = 'RegistrySettings'
|
||||
Settings = 'RegistrySettings'
|
||||
Code = {
|
||||
ConvertTo-XMLRegistrySettings -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
ConvertTo-XMLRegistrySettings -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
#>
|
||||
Scripts = [ordered] @{
|
||||
Category = 'Scripts'
|
||||
Settings = 'Script'
|
||||
@@ -94,15 +95,18 @@
|
||||
ConvertTo-XMLScripts -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
<#
|
||||
SecurityOptions = [ordered] @{
|
||||
Category = 'SecuritySettings'
|
||||
Settings = 'SecurityOptions'
|
||||
Code = {
|
||||
ConvertTo-SecurityOptions -GPOList $GPOList
|
||||
SecurityOptions = [ordered] @{
|
||||
Category = 'SecuritySettings'
|
||||
Settings = 'SecurityOptions'
|
||||
Code = {
|
||||
#ConvertTo-SecurityOptions -GPOList $GPOList
|
||||
ConvertTo-XMLSecurityOptions -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
#ConvertTo-SecurityOptions -GPOList $GPOList
|
||||
ConvertTo-XMLSecurityOptions -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
#>
|
||||
SoftwareInstallation = [ordered] @{
|
||||
Category = 'SoftwareInstallationSettings'
|
||||
Settings = 'MsiApplication'
|
||||
@@ -114,24 +118,30 @@
|
||||
ConvertTo-XMLSoftwareInstallation -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
<#
|
||||
SystemServices = [ordered] @{
|
||||
SystemServices = [ordered] @{
|
||||
Description = ''
|
||||
GPOPath = 'Computer Configuration -> Policies -> Windows Settings -> Security Settings -> System Services'
|
||||
Category = 'SecuritySettings'
|
||||
Settings = 'SystemServices'
|
||||
Code = {
|
||||
ConvertTo-SystemServices -GPOList $GPOList
|
||||
# ConvertTo-SoftwareInstallation -GPOList $GPOList
|
||||
ConvertTo-XMLSystemServices -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
ConvertTo-XMLSystemServices -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
SystemServicesNT = [ordered] @{
|
||||
SystemServicesNT = [ordered] @{
|
||||
Description = ''
|
||||
GPOPath = 'Computer Configuration -> Preferences -> Control Pannel Settings -> Services'
|
||||
Category = 'ServiceSettings'
|
||||
Settings = 'NTServices'
|
||||
Code = {
|
||||
ConvertTo-SystemServicesNT -GPOList $GPOList
|
||||
# ConvertTo-SoftwareInstallation -GPOList $GPOList
|
||||
ConvertTo-XMLSystemServicesNT -GPO $GPO
|
||||
}
|
||||
CodeSingle = {
|
||||
ConvertTo-XMLSystemServicesNT -GPO $GPO -SingleObject
|
||||
}
|
||||
}
|
||||
#>
|
||||
}
|
||||
+28
-16
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user