From ee3b25ee8873e92626f2cd77365350cacac57a62 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Wed, 7 Feb 2024 14:14:27 +0100 Subject: [PATCH] Force specific DC for search --- Public/Invoke-GPOZaurrContent.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Public/Invoke-GPOZaurrContent.ps1 b/Public/Invoke-GPOZaurrContent.ps1 index 3b9a087..b42d3f5 100644 --- a/Public/Invoke-GPOZaurrContent.ps1 +++ b/Public/Invoke-GPOZaurrContent.ps1 @@ -110,6 +110,8 @@ $Output['Reports'] = [ordered] @{} $Output['CategoriesFull'] = [ordered] @{} + $ForestInformation = Get-WinADForestDetails -PreferWritable + Write-Verbose "Invoke-GPOZaurrContent - Loading GPO Report to Categories" $CountGPO = 0 [Array] $GPOCategories = foreach ($GPO in $GPOs) { @@ -118,7 +120,8 @@ if ($GPOPath) { $GPOOutput = $GPO.GPOOutput } else { - [xml] $GPOOutput = Get-GPOReport -Guid $GPO.GUID -Domain $GPO.DomainName -ReportType Xml + $QueryServer = $ForestInformation['QueryServers'][$GPO.DomainName].HostName[0] + [xml] $GPOOutput = Get-GPOReport -Guid $GPO.GUID -Domain $GPO.DomainName -ReportType Xml -Server $QueryServer } Get-GPOCategories -GPO $GPO -GPOOutput $GPOOutput.GPO -Splitter $Splitter -FullObjects:$FullObjects -CachedCategories $Output['CategoriesFull'] }