Add support for RestrcitedGroups #68

This commit is contained in:
Przemyslaw Klys
2024-11-20 21:50:02 +01:00
parent a374433922
commit 4f4fddddae
3 changed files with 99 additions and 3 deletions
+77
View File
@@ -0,0 +1,77 @@
function ConvertTo-XMLRestrictedGroups {
[cmdletBinding()]
param(
[PSCustomObject] $GPO,
[switch] $SingleObject
)
if ($SingleObject) {
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
#GpoCategory = $GPOEntry.GpoCategory
#GpoSettings = $GPOEntry.GpoSettings
Count = 0
Settings = $null
}
[Array] $CreateGPO['Settings'] = foreach ($Script in $GPO.DataSet) {
$Members = foreach ($Member in $Group.Member) {
if ($($Member.SID.'#text')) {
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
} else {
$Member.Name.'#text'
}
}
$MemberOf = foreach ($Member in $Group.MemberOf) {
if ($($Member.SID.'#text')) {
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
} else {
$Member.Name.'#text'
}
}
[PSCustomObject]@{
GroupName = $Group.GroupName.Name
GroupSID = $Group.GroupName.SID.'#text'
Members = $Members -join ', '
MembersOf = $MemberOf -join ', '
}
}
$CreateGPO['DataCount'] = $CreateGPO['Settings'].Count
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
} else {
foreach ($Group in $GPO.DataSet) {
$Members = foreach ($Member in $Group.Member) {
if ($($Member.SID.'#text')) {
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
} else {
$Member.Name.'#text'
}
}
$MemberOf = foreach ($Member in $Group.MemberOf) {
if ($($Member.SID.'#text')) {
"$($Member.Name.'#text') ($($Member.SID.'#text'))"
} else {
$Member.Name.'#text'
}
}
$CreateGPO = [ordered]@{
DisplayName = $GPO.DisplayName
DomainName = $GPO.DomainName
GUID = $GPO.GUID
GpoType = $GPO.GpoType
GroupName = $Group.GroupName.Name.'#text'
GroupSID = $Group.GroupName.SID.'#text'
Members = $Members -join ', '
MembersOf = $MemberOf -join ', '
}
$CreateGPO['Linked'] = $GPO.Linked
$CreateGPO['LinksCount'] = $GPO.LinksCount
$CreateGPO['Links'] = $GPO.Links
[PSCustomObject] $CreateGPO
}
}
}
+16 -1
View File
@@ -380,7 +380,7 @@
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'FSLogix' -SingleObject
}
}
Firefox = @{
Firefox = @{
Types = @(
@{
Category = 'RegistrySettings'
@@ -974,6 +974,21 @@
ConvertTo-XMLGenericPolicy -GPO $GPO -Category 'Windows Components/Remote Desktop Services*' -SingleObject
}
}
RestrictedGroups = @{
Types = @(
@{
Category = 'SecuritySettings'
Settings = 'RestrictedGroups'
}
)
GPOPath = 'Policies -> Windows Settings -> Security Settings -> Restricted Groups'
Code = {
ConvertTo-XMLRestrictedGroups -GPO $GPO
}
CodeSingle = {
ConvertTo-XMLRestrictedGroups -GPO $GPO -SingleObject
}
}
RSSFeeds = @{
Types = @(
@{
+6 -2
View File
@@ -156,13 +156,17 @@
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOName $Name
}
foreach ($GUID in $GPOGUID) {
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOGUID $GUID
Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation -GPOGuid $GUID
}
)
} else {
Write-Verbose "Invoke-GPOZaurrContent - Query AD for GPOs"
[Array] $GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
}
if ($GPOs.Count -eq 0) {
Write-Warning "Invoke-GPOZaurrContent - No GPOs found. Exiting."
return
}
# This caches single reports.
$TemporaryCachedSingleReports = [ordered] @{}
$TemporaryCachedSingleReports['ReportsSingle'] = [ordered] @{}
@@ -171,7 +175,7 @@
$Output['Reports'] = [ordered] @{}
$Output['CategoriesFull'] = [ordered] @{}
$ForestInformation = Get-WinADForestDetails -PreferWritable -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
$ForestInformation = Get-WinADForestDetails -PreferWritable -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation
Write-Verbose "Invoke-GPOZaurrContent - Loading GPO Report to Categories"
$CountGPO = 0