Add ability to limit GPO analysis by GPOName/GPOGUID

This commit is contained in:
Przemyslaw Klys
2024-02-04 09:09:36 +01:00
parent e3e5582696
commit c757c8281b
3 changed files with 22 additions and 3 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
ActionRequired = $null
Data = $null
Execute = {
Invoke-GPOZaurrContent -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains
Invoke-GPOZaurrContent -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -GPOName $GPOName -GPOGUID $GPOGUID
}
Processing = {
+4 -1
View File
@@ -75,7 +75,10 @@
[string[]] $ExcludeDomains,
[alias('Domain', 'Domains')][string[]] $IncludeDomains,
[switch] $Online,
[switch] $SplitReports
[switch] $SplitReports,
[Alias('Name')][string[]] $GPOName,
[Alias('GUID')][string[]] $GPOGUID
)
Reset-GPOZaurrStatus # This makes sure types are at it's proper status
+17 -1
View File
@@ -53,7 +53,13 @@
[Parameter(ParameterSetName = 'Local')]
[switch] $SkipCleanup,
[switch] $Extended
[switch] $Extended,
[Parameter(ParameterSetName = 'Default')]
[Alias('Name')][string[]] $GPOName,
[Parameter(ParameterSetName = 'Default')]
[string[]] $GPOGUID
)
if ($Type.Count -eq 0) {
$Type = $Script:GPODitionary.Keys
@@ -82,6 +88,16 @@
Write-Warning "Invoke-GPOZaurrContent - $GPOPath doesn't exists."
return
}
} elseif ($GPOName) {
Write-Verbose "Invoke-GPOZaurrContent - Query AD for GPOs"
[Array] $GPOs = @(
foreach ($Name in $GPOName) {
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
}
)
} else {
Write-Verbose "Invoke-GPOZaurrContent - Query AD for GPOs"
[Array] $GPOs = Get-GPOZaurrAD -Forest $Forest -IncludeDomains $IncludeDomains -ExcludeDomains $ExcludeDomains -ExtendedForestInformation $ExtendedForestInformation