38 lines
1.2 KiB
PowerShell
38 lines
1.2 KiB
PowerShell
$domain = 'cascades.local'
|
|
$gpoName = 'CSC - Folder Redirection'
|
|
|
|
$gpo = Get-GPO -Name $gpoName -Domain $domain -EA Stop
|
|
Write-Output "GPO: $($gpo.DisplayName)"
|
|
Write-Output "GUID: {$($gpo.Id.ToString().ToUpper())}"
|
|
Write-Output "Status: $($gpo.GpoStatus)"
|
|
Write-Output ""
|
|
|
|
Write-Output "=== Security Filter (who this GPO applies to) ==="
|
|
Get-GPPermission -Name $gpoName -Domain $domain -All | ForEach-Object {
|
|
Write-Output " $($_.Trustee.Name) [$($_.Trustee.TrusteeType)] — $($_.Permission)"
|
|
}
|
|
|
|
Write-Output ""
|
|
Write-Output "=== GPO Links ==="
|
|
$report = Get-GPOReport -Name $gpoName -Domain $domain -ReportType Xml
|
|
$xml = [xml]$report
|
|
$links = $xml.GPO.LinksTo
|
|
if ($links) {
|
|
foreach ($l in $links) {
|
|
Write-Output " $($l.SOMPath) — Enabled: $($l.Enabled) — NoOverride: $($l.NoOverride)"
|
|
}
|
|
} else {
|
|
Write-Output " (no links)"
|
|
}
|
|
|
|
Write-Output ""
|
|
Write-Output "=== SYSVOL contents ==="
|
|
$srv = 'CS-SERVER'
|
|
$sysvol = "\\$srv\SYSVOL\$domain\Policies"
|
|
$guid = "{$($gpo.Id.ToString().ToUpper())}"
|
|
Get-ChildItem "$sysvol\$guid" -Recurse -EA SilentlyContinue | ForEach-Object {
|
|
$rel = $_.FullName.Replace("$sysvol\$guid", '')
|
|
$type = if ($_.PSIsContainer) { '[DIR]' } else { "[FILE $($_.Length)b]" }
|
|
Write-Output " $type $rel"
|
|
}
|