From 569c7ed910ce169bdb05051621c8e502a3e16584 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Thu, 12 Nov 2020 15:33:28 +0100 Subject: [PATCH] Update example --- .../Example-11-ReplaceGPOOwnerAutomated.ps1 | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Examples/Example-11-ReplaceGPOOwnerAutomated.ps1 b/Examples/Example-11-ReplaceGPOOwnerAutomated.ps1 index eaf6c5e..fdb3da3 100644 --- a/Examples/Example-11-ReplaceGPOOwnerAutomated.ps1 +++ b/Examples/Example-11-ReplaceGPOOwnerAutomated.ps1 @@ -4,14 +4,18 @@ # And also can fix at the same time NotAdministrative - this basically looks for users/groups that are not Domain Admins or Enterprise Admins # regardless if current user is still Domain Admin or not -$GPOs = Get-GPOZaurrOwner -IncludeSysvol #-GPOName +$GPOs = Get-GPOZaurrOwner -IncludeSysvol $GPOs | Format-Table DisplayName, Owner, OwnerSID, OwnerType, SysvolOwner, SysvolSID, SysvolType -#Set-GPOZaurrOwner -Type Unknown -Verbose #-LimitProcessing 2 -WhatIf -Set-GPOZaurrOwner -Type NotAdministrative -Verbose -LimitProcessing 2 -WhatIf -#Set-GPOZaurrOwner -Type NotMatching -Verbose -LimitProcessing 2 -WhatIf +Set-GPOZaurrOwner -Type Unknown -Verbose -WhatIf #-LimitProcessing 2 +Set-GPOZaurrOwner -Type All -Verbose -LimitProcessing 2 -WhatIf -IncludeDomains 'ad.evotec.pl' +Set-GPOZaurrOwner -Type NotMatching -Verbose -LimitProcessing 2 -WhatIf -#Set-GPOZaurrOwner -GPOName 'COMPUTERS | Enable Sets' -Verbose -Principal 'przemyslaw.klys' -WhatIf #-SkipSysvol -#Set-GPOZaurrOwner -GPOName 'New Group Policy Object' -Verbose #-WhatIf #-SkipSysvol -#$GPOs = Get-GPOZaurrOwner -IncludeSysvol #-GPOName 'New Group Policy Object' -#$GPOs | Format-Table DisplayName, Owner, OwnerSID \ No newline at end of file +# This will only set it to przemyslaw klys if the owner is not Domain Admins / Enterprise Admins +# it's not working currently for any other object +# You can enforce -Force to set it to any other principal +Set-GPOZaurrOwner -GPOName 'COMPUTERS | Enable Sets' -Verbose -Principal 'przemyslaw.klys' -WhatIf:$false -Force #-SkipSysvol +Set-GPOZaurrOwner -GPOName 'New Group Policy Object' -Verbose -WhatIf #-SkipSysvol + +$GPOs = Get-GPOZaurrOwner -IncludeSysvol #-GPOName 'New Group Policy Object' +$GPOs | Format-Table DisplayName, Owner, OwnerSID \ No newline at end of file