Files
claudetools/.claude/temp/frd-link.ps1
Howard Enos bc984d9c78 sync: auto-sync from HOWARD-HOME at 2026-05-20 17:08:25
Author: Howard Enos
Machine: HOWARD-HOME
Timestamp: 2026-05-20 17:08:25
2026-05-20 17:08:29 -07:00

43 lines
1.3 KiB
PowerShell

$domain = 'cascades.local'
$gpoName = 'CSC - Folder Redirection'
$ouDN = 'OU=Administrative,OU=Departments,DC=cascades,DC=local'
Import-Module GroupPolicy -EA SilentlyContinue
# Link GPO to OU=Administrative
try {
New-GPLink -Name $gpoName -Domain $domain -Target $ouDN -LinkEnabled Yes -EA Stop
Write-Output "[OK] Linked to $ouDN"
} catch {
if ($_.Exception.Message -like '*already*') {
Set-GPLink -Name $gpoName -Domain $domain -Target $ouDN -LinkEnabled Yes -EA SilentlyContinue
Write-Output "[OK] Link already existed — enabled"
} else {
Write-Output "[ERROR] $($_.Exception.Message)"
}
}
Write-Output ""
Write-Output "=== Security Filter ==="
Get-GPPermission -Name $gpoName -Domain $domain -All | ForEach-Object {
Write-Output " $($_.Trustee.Name) [$($_.Trustee.TrusteeType)] — $($_.Permission)"
}
Write-Output ""
Write-Output "=== Links ==="
$report = [xml](Get-GPOReport -Name $gpoName -Domain $domain -ReportType Xml)
$links = $report.GPO.LinksTo
if ($links) {
foreach ($l in $links) {
Write-Output " $($l.SOMPath) — Enabled: $($l.Enabled)"
}
} else {
Write-Output " (none)"
}
Write-Output ""
Write-Output "=== SG-FolderRedirect members ==="
Get-ADGroupMember -Identity 'SG-FolderRedirect' -EA SilentlyContinue | ForEach-Object {
Write-Output " $($_.SamAccountName)"
}