mirror of
https://github.com/EvotecIT/GPOZaurr.git
synced 2026-08-20 15:12:24 +00:00
More work on Find-GPO
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
function Get-XMLGPOTypes {
|
||||
[cmdletBinding()]
|
||||
param(
|
||||
[PSCustomObject] $GPO,
|
||||
[System.Xml.XmlElement[]] $GPOOutput,
|
||||
[string] $Splitter = [System.Environment]::NewLine,
|
||||
[switch] $FullObjects
|
||||
)
|
||||
|
||||
$Types = [ordered] @{
|
||||
User = [System.Collections.Generic.List[string]]::new()
|
||||
Computer = [System.Collections.Generic.List[string]]::new()
|
||||
All = $null
|
||||
}
|
||||
|
||||
[Array] $TypesReturn = foreach ($Type in @('User', 'Computer')) {
|
||||
if ($GPOOutput.$Type.ExtensionData.Extension) {
|
||||
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
|
||||
$GPOSettingType = ($ExtensionType.type -split ':')[1]
|
||||
# add to hashtable
|
||||
$Types["$Type"].Add($GPOSettingType)
|
||||
# add to array
|
||||
$GPOSettingType
|
||||
}
|
||||
}
|
||||
}
|
||||
$Types.Computer = $Types.Computer | Sort-Object -Unique
|
||||
$Types.User = $Types.User | Sort-Object -Unique
|
||||
$Types.All = $TypesReturn | Sort-Object -Unique
|
||||
$Types
|
||||
}
|
||||
+20
-26
@@ -10,34 +10,28 @@
|
||||
foreach ($Type in @('User', 'Computer')) {
|
||||
if ($GPOOutput.$Type.ExtensionData.Extension) {
|
||||
foreach ($ExtensionType in $GPOOutput.$Type.ExtensionData.Extension) {
|
||||
$GPOSettingType = ($ExtensionType.type -split ':')[1]
|
||||
Write-Warning $GPOSettingType
|
||||
foreach ($Key in $ExtensionType.Account) {
|
||||
[PSCustomObject] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
Linked = $LinksInformation.Linked
|
||||
LinksCount = $LinksInformation.LinksCount
|
||||
Links = $LinksInformation.Links
|
||||
GpoType = $Type
|
||||
Name = $Key.Name
|
||||
Type = $Key.Type
|
||||
SettingNumber = $Key.SettingNumber
|
||||
SettingBoolean = if ($Key.SettingBoolean -eq 'true') { $true } elseif ($Key.SettingBoolean -eq 'false') { $false } else { $null }
|
||||
$GPOSettingTypeSplit = ($ExtensionType.type -split ':')
|
||||
$KeysToLoop = $ExtensionType | Get-Member -MemberType Properties | Where-Object { $_.Name -notin 'type', $GPOSettingTypeSplit[0] }
|
||||
foreach ($Keys in $KeysToLoop.Name) {
|
||||
foreach ($Key in $ExtensionType.$Keys) {
|
||||
$Template = [ordered] @{
|
||||
DisplayName = $GPO.DisplayName
|
||||
DomainName = $GPO.DomainName
|
||||
GUID = $GPO.Guid
|
||||
Linked = $LinksInformation.Linked
|
||||
LinksCount = $LinksInformation.LinksCount
|
||||
Links = $LinksInformation.Links
|
||||
GpoType = $Type
|
||||
GpoSubType = $GPOSettingTypeSplit[1]
|
||||
}
|
||||
$Properties = ($Key | Get-Member -MemberType Properties).Name
|
||||
foreach ($Property in $Properties) {
|
||||
$Template["$Property"] = $Key.$Property
|
||||
}
|
||||
[PSCustomObject] $Template
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
q1 : http://www.microsoft.com/GroupPolicy/Settings/Security
|
||||
type : q1:SecuritySettings
|
||||
Account : {ClearTextPassword, LockoutBadCount, LockoutDuration, MaximumPasswordAge...}
|
||||
SecurityOptions : SecurityOptions
|
||||
SystemServices : SystemServices
|
||||
#>
|
||||
|
||||
#$GPOSettingType = ($ExtensionType.type -split ':')[1]
|
||||
}
|
||||
+13
-1
@@ -57,7 +57,7 @@
|
||||
}
|
||||
$Output = [ordered] @{}
|
||||
foreach ($T in $Type) {
|
||||
$Output[$T] = [System.Collections.Generic.List[PSCustomObject]]::new()
|
||||
# $Output[$T] = [System.Collections.Generic.List[PSCustomObject]]::new()
|
||||
}
|
||||
foreach ($GPO in $GPOs) {
|
||||
if ($GPOPath) {
|
||||
@@ -77,6 +77,18 @@
|
||||
UserPolicies = $GPOOutput.GPO.User.ExtensionData.Name -join ", "
|
||||
}
|
||||
#>
|
||||
$GPOStoredTypes = Get-XMLGPOTypes -GPOOutput $GPOOutput.GPO
|
||||
|
||||
[Array] $Data = Get-XMLStandard -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects
|
||||
foreach ($D in $Data) {
|
||||
if (-not $Output["$($D.GpoSubType)"]) {
|
||||
$Output["$($D.GpoSubType)"] = [System.Collections.Generic.List[PSCustomObject]]::new()
|
||||
}
|
||||
$Output["$($D.GpoSubType)"].Add($D)
|
||||
}
|
||||
|
||||
continue
|
||||
|
||||
if ($Type -contains 'RegistrySettings') {
|
||||
[Array] $Data = Get-XMLRegistrySettings -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects
|
||||
foreach ($D in $Data) {
|
||||
|
||||
Reference in New Issue
Block a user