-
-
Save HarmJ0y/43f59722565de09670be6b541935562b to your computer and use it in GitHub Desktop.
OU_edit_metadata.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# specify the GPO we're enumerating | |
$OUName = "TestOU1_policy" | |
# enumerate the last time the GPO was changed, based on the replication metadata of the 'versionNumber' property | |
$LastGPOChange = ([datetime](Get-DomainObjectAttributeHistory $OUName -Properties versionNumber | Select-Object -ExpandProperty LastOriginatingChange)).ToUniversalTime() | |
# grab the SYSVOL path for this particular GPO | |
$Path = Get-DomainObject $OUName | Select-Object -ExpandProperty gpcfilesyspath | |
# enumerate all files in the GPO edited +/- 20 seconds from the 'versionNumber' modification time | |
Get-ChildItem $Path -Recurse -Exclude 'GPT.ini' | ? { | |
($_.LastWriteTimeUtc -gt $LastGPOChange.AddSeconds(-20)) -and ($_.LastWriteTimeUtc -lt $LastGPOChange.AddSeconds(20)) | |
} | Sort-Object -Property LastWriteTime -Descending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment