Created
May 30, 2024 14:07
-
-
Save joshfinley/2d72d2e0080e308b56a38e155fbfc7d4 to your computer and use it in GitHub Desktop.
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
# Import the Group Policy module | |
Import-Module GroupPolicy | |
# Get all the Group Policy Objects (GPOs) | |
$GPOs = Get-GPO -All | |
# Initialize an array to store GPOs with File System security settings | |
$GPOsWithSysvolPermissions = @() | |
# Loop through each GPO and check for File System security settings affecting SYSVOL | |
foreach ($GPO in $GPOs) { | |
$Report = Get-GPOReport -Guid $GPO.Id -ReportType XML | |
[xml]$GPOReport = $Report | |
$FileSystemSettings = $GPOReport.GPO.Computer.FileSystem.File | |
foreach ($FileSetting in $FileSystemSettings) { | |
if ($FileSetting.Path -like "*SYSVOL*") { | |
$GPOInfo = New-Object PSObject -Property @{ | |
GPOName = $GPO.DisplayName | |
GPOGUID = $GPO.Id | |
FilePath = $FileSetting.Path | |
Permissions = $FileSetting.SecurityDescriptor | |
} | |
$GPOsWithSysvolPermissions += $GPOInfo | |
} | |
} | |
} | |
# Display the GPOs with SYSVOL permissions | |
$GPOsWithSysvolPermissions | Format-Table -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment