mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-09-01 21:28:12 +00:00
Update
This commit is contained in:
@@ -2,11 +2,11 @@ function ConvertTo-XMLGenericPublicKey {
|
|||||||
[cmdletBinding()]
|
[cmdletBinding()]
|
||||||
param(
|
param(
|
||||||
[PSCustomObject] $GPO,
|
[PSCustomObject] $GPO,
|
||||||
[string[]] $Category
|
[string[]] $Category,
|
||||||
|
[switch] $SingleObject
|
||||||
)
|
)
|
||||||
|
|
||||||
$SkipNames = ('Name', 'LocalName', 'NamespaceURI', 'Prefix', 'NodeType', 'ParentNode', 'OwnerDocument', 'IsEmpty', 'Attributes', 'HasAttributes', 'SchemaInfo', 'InnerXml', 'InnerText', 'NextSibling', 'PreviousSibling', 'ChildNodes', 'FirstChild', 'LastChild', 'HasChildNodes', 'IsReadOnly', 'OuterXml', 'BaseURI', 'PreviousText')
|
$SkipNames = ('Name', 'LocalName', 'NamespaceURI', 'Prefix', 'NodeType', 'ParentNode', 'OwnerDocument', 'IsEmpty', 'Attributes', 'HasAttributes', 'SchemaInfo', 'InnerXml', 'InnerText', 'NextSibling', 'PreviousSibling', 'ChildNodes', 'FirstChild', 'LastChild', 'HasChildNodes', 'IsReadOnly', 'OuterXml', 'BaseURI', 'PreviousText')
|
||||||
foreach ($Setting in $GPO.DataSet) {
|
if ($SingleObject) {
|
||||||
$CreateGPO = [ordered]@{
|
$CreateGPO = [ordered]@{
|
||||||
DisplayName = $GPO.DisplayName
|
DisplayName = $GPO.DisplayName
|
||||||
DomainName = $GPO.DomainName
|
DomainName = $GPO.DomainName
|
||||||
@@ -14,23 +14,57 @@ function ConvertTo-XMLGenericPublicKey {
|
|||||||
GpoType = $GPO.GpoType
|
GpoType = $GPO.GpoType
|
||||||
#GpoCategory = $GPOEntry.GpoCategory
|
#GpoCategory = $GPOEntry.GpoCategory
|
||||||
#GpoSettings = $GPOEntry.GpoSettings
|
#GpoSettings = $GPOEntry.GpoSettings
|
||||||
|
Count = 0
|
||||||
|
Settings = $null
|
||||||
}
|
}
|
||||||
$SettingName = $Setting.Name -split ":"
|
[Array] $CreateGPO['Settings'] = foreach ($Setting in $GPO.DataSet) {
|
||||||
$CreateGPO['CreatedTime'] = $GPO.CreatedTime # : 06.06.2020 18:03:36
|
$SettingName = $Setting.Name -split ":"
|
||||||
$CreateGPO['ModifiedTime'] = $GPO.ModifiedTime # : 17.06.2020 16:08:10
|
$MySettings = [ordered] @{
|
||||||
$CreateGPO['ReadTime'] = $GPO.ReadTime # : 13.08.2020 10:15:37
|
CreatedTime = $GPO.CreatedTime # : 06.06.2020 18:03:36
|
||||||
$CreateGPO['SecurityDescriptor'] = $GPO.SecurityDescriptor # : SecurityDescriptor
|
ModifiedTime = $GPO.ModifiedTime # : 17.06.2020 16:08:10
|
||||||
$CreateGPO['FilterDataAvailable'] = $GPO.FilterDataAvailable # : True
|
ReadTime = $GPO.ReadTime # : 13.08.2020 10:15:37
|
||||||
|
SecurityDescriptor = $GPO.SecurityDescriptor # : SecurityDescriptor
|
||||||
|
FilterDataAvailable = $GPO.FilterDataAvailable # : True
|
||||||
|
}
|
||||||
|
$Name = $SettingName[1]
|
||||||
|
#$Name = Format-ToTitleCase -Text $Setting.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
|
||||||
|
$MySettings['Name'] = $Name # $Setting.Name
|
||||||
|
|
||||||
$Name = $SettingName[1]
|
ConvertTo-XMLNested -CreateGPO $MySettings -Setting $Setting -SkipNames $SkipNames #-Name $Name
|
||||||
#$Name = Format-ToTitleCase -Text $Setting.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
|
[PSCustomObject] $MySettings
|
||||||
$CreateGPO['Name'] = $Name # $Setting.Name
|
}
|
||||||
#$CreateGPO['GPOSettingOrder'] = $Setting.GPOSettingOrder
|
|
||||||
|
|
||||||
#foreach ($Property in ($Setting.Properties | Get-Member -MemberType Properties).Name) {
|
$CreateGPO['Count'] = $CreateGPO['Settings'].Count
|
||||||
|
$CreateGPO['Linked'] = $GPO.Linked
|
||||||
|
$CreateGPO['LinksCount'] = $GPO.LinksCount
|
||||||
|
$CreateGPO['Links'] = $GPO.Links
|
||||||
|
[PSCustomObject] $CreateGPO
|
||||||
|
} else {
|
||||||
|
foreach ($Setting in $GPO.DataSet) {
|
||||||
|
$CreateGPO = [ordered]@{
|
||||||
|
DisplayName = $GPO.DisplayName
|
||||||
|
DomainName = $GPO.DomainName
|
||||||
|
GUID = $GPO.GUID
|
||||||
|
GpoType = $GPO.GpoType
|
||||||
|
#GpoCategory = $GPOEntry.GpoCategory
|
||||||
|
#GpoSettings = $GPOEntry.GpoSettings
|
||||||
|
}
|
||||||
|
$SettingName = $Setting.Name -split ":"
|
||||||
|
$CreateGPO['CreatedTime'] = $GPO.CreatedTime # : 06.06.2020 18:03:36
|
||||||
|
$CreateGPO['ModifiedTime'] = $GPO.ModifiedTime # : 17.06.2020 16:08:10
|
||||||
|
$CreateGPO['ReadTime'] = $GPO.ReadTime # : 13.08.2020 10:15:37
|
||||||
|
$CreateGPO['SecurityDescriptor'] = $GPO.SecurityDescriptor # : SecurityDescriptor
|
||||||
|
$CreateGPO['FilterDataAvailable'] = $GPO.FilterDataAvailable # : True
|
||||||
|
|
||||||
ConvertTo-XMLNested -CreateGPO $CreateGPO -Setting $Setting -SkipNames $SkipNames #-Name $Name
|
$Name = $SettingName[1]
|
||||||
<#
|
#$Name = Format-ToTitleCase -Text $Setting.Name -RemoveWhiteSpace -RemoveChar ',', '-', "'", '\(', '\)', ':'
|
||||||
|
$CreateGPO['Name'] = $Name # $Setting.Name
|
||||||
|
#$CreateGPO['GPOSettingOrder'] = $Setting.GPOSettingOrder
|
||||||
|
|
||||||
|
#foreach ($Property in ($Setting.Properties | Get-Member -MemberType Properties).Name) {
|
||||||
|
|
||||||
|
ConvertTo-XMLNested -CreateGPO $CreateGPO -Setting $Setting -SkipNames $SkipNames #-Name $Name
|
||||||
|
<#
|
||||||
$Properties = $Setting.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
|
$Properties = $Setting.PSObject.Properties.Name | Where-Object { $_ -notin $SkipNames }
|
||||||
foreach ($Property in $Properties) {
|
foreach ($Property in $Properties) {
|
||||||
If ($Property -eq 'Value') {
|
If ($Property -eq 'Value') {
|
||||||
@@ -62,13 +96,11 @@ function ConvertTo-XMLGenericPublicKey {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#>
|
#>
|
||||||
|
$CreateGPO['Filters'] = $Setting.Filters
|
||||||
|
$CreateGPO['Linked'] = $GPO.Linked
|
||||||
$CreateGPO['Filters'] = $Setting.Filters
|
$CreateGPO['LinksCount'] = $GPO.LinksCount
|
||||||
|
$CreateGPO['Links'] = $GPO.Links
|
||||||
$CreateGPO['Linked'] = $GPO.Linked
|
[PSCustomObject] $CreateGPO
|
||||||
$CreateGPO['LinksCount'] = $GPO.LinksCount
|
}
|
||||||
$CreateGPO['Links'] = $GPO.Links
|
|
||||||
[PSCustomObject] $CreateGPO
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,9 @@
|
|||||||
|
|
||||||
[Parameter(ParameterSetName = 'Default')]
|
[Parameter(ParameterSetName = 'Default')]
|
||||||
[Parameter(ParameterSetName = 'Local')]
|
[Parameter(ParameterSetName = 'Local')]
|
||||||
[switch] $SkipCleanup
|
[switch] $SkipCleanup,
|
||||||
|
|
||||||
|
[switch] $Extended
|
||||||
)
|
)
|
||||||
if ($Type.Count -eq 0) {
|
if ($Type.Count -eq 0) {
|
||||||
$Type = $Script:GPODitionary.Keys
|
$Type = $Script:GPODitionary.Keys
|
||||||
@@ -219,9 +221,18 @@
|
|||||||
#$Output['PoliciesTotal'] = $Output.Reports.Policies.PolicyCategory | Group-Object | Select-Object Name, Count | Sort-Object -Property Count -Descending
|
#$Output['PoliciesTotal'] = $Output.Reports.Policies.PolicyCategory | Group-Object | Select-Object Name, Count | Sort-Object -Property Count -Descending
|
||||||
|
|
||||||
if (-not $SkipCleanup) {
|
if (-not $SkipCleanup) {
|
||||||
|
Write-Verbose "Invoke-GPOZaurr - Cleaning up output"
|
||||||
Remove-EmptyValue -Hashtable $Output -Recursive
|
Remove-EmptyValue -Hashtable $Output -Recursive
|
||||||
}
|
}
|
||||||
return $Output
|
if ($Extended) {
|
||||||
|
$Output
|
||||||
|
} else {
|
||||||
|
if ($Output.Reports) {
|
||||||
|
$Output.Reports
|
||||||
|
} else {
|
||||||
|
Write-Warning "Invoke-GPOZaurr - There was no data output for requested types."
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[scriptblock] $SourcesAutoCompleter = {
|
[scriptblock] $SourcesAutoCompleter = {
|
||||||
|
|||||||
@@ -17,8 +17,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$null = New-Item -ItemType Directory -Path $GPOPath -Force
|
$null = New-Item -ItemType Directory -Path $GPOPath -Force
|
||||||
|
Write-Verbose "Save-GPOZaurrFiles - Gathering GPO data"
|
||||||
|
$Count = 0
|
||||||
$GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
$GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
|
||||||
foreach ($GPO in $GPOS) {
|
foreach ($GPO in $GPOS) {
|
||||||
|
$Count++
|
||||||
|
Write-Verbose "Save-GPOZaurrFiles - Processing GPO ($Count/$($GPOS.Count)) $($GPO.DomainName) | $($GPO.DisplayName)"
|
||||||
$XMLContent = Get-GPOReport -ID $GPO.Guid -ReportType XML -Domain $GPO.DomainName
|
$XMLContent = Get-GPOReport -ID $GPO.Guid -ReportType XML -Domain $GPO.DomainName
|
||||||
$GPODOmainFolder = [io.path]::Combine($GPOPath, $GPO.DomainName)
|
$GPODOmainFolder = [io.path]::Combine($GPOPath, $GPO.DomainName)
|
||||||
if (-not (Test-Path -Path $GPODOmainFolder)) {
|
if (-not (Test-Path -Path $GPODOmainFolder)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user