Skip to content

Instantly share code, notes, and snippets.

@joshfinley
Created May 30, 2024 14:07
Show Gist options
  • Save joshfinley/2d72d2e0080e308b56a38e155fbfc7d4 to your computer and use it in GitHub Desktop.
Save joshfinley/2d72d2e0080e308b56a38e155fbfc7d4 to your computer and use it in GitHub Desktop.
# 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