Files
GPOZaurr/Examples/Example-10-ReplaceGPOOwner.ps1
T
Przemysław Kłys 82e0e16019 Updates
2020-04-12 10:31:49 +02:00

21 lines
597 B
PowerShell

Import-Module "$PSScriptRoot\..\GPoZaurr.psd1" -Force
$LImitProcessing = 2
# check what is there now
$GPOs = Get-GPOZaurr #-GPOName 'New Group Policy Object'
$GPOs | Format-Table DisplayName, Owner, OwnerSID
$Count = 0
# loop thru all GPOS (or use LimitProcessing)
foreach ($GPO in $GPOS) {
$Count++
Set-GPOZaurrOwner -GPOID $GPO.GUID -Verbose -Principal 'przemyslaw.klys@evotec.pl' #-WhatIf
if ($Count -eq $LImitProcessing) {
break
}
}
# Confirm what changed
$GPOs = Get-GPOZaurr #-GPOName 'New Group Policy Object'
$GPOs | Format-Table DisplayName, Owner, OwnerSID