Move 150+ scripts from root and scripts/ into client/project directories: - clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts) - clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination) - clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups) - projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto) - projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts) - clients/glaztech/scripts/ (1 file: CentraStage removal) Also reorganized: - VPN scripts → infrastructure/vpn-configs/ - Retrieved API/JS files → api/ - Forum posts → projects/community-forum/forum-posts/ - SSH docs → clients/internal-infrastructure/docs/ - NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/ - ACG website files → projects/internal/acg-website-2025/ - Dataforth docs → clients/dataforth/docs/ - schema-retrieved.sql → docs/database/ Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history). Root reduced from 220+ files to 62 items (docs + directories only). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
84 lines
3.1 KiB
PowerShell
84 lines
3.1 KiB
PowerShell
# BG Builders - Check and fix inbox rules on lesley shared mailbox
|
|
# Run from interactive PowerShell
|
|
|
|
$lesleyUPN = "lesley@bgbuildersllc.com"
|
|
|
|
Write-Output "Connecting to Exchange Online..."
|
|
Import-Module ExchangeOnlineManagement
|
|
Connect-ExchangeOnline -UserPrincipalName "sysadmin@bgbuildersllc.com" -ShowBanner:$false
|
|
Write-Output "[OK] Connected"
|
|
|
|
# Check inbox rules
|
|
Write-Output "`n=== INBOX RULES ==="
|
|
$rules = Get-InboxRule -Mailbox $lesleyUPN -IncludeHidden
|
|
if ($rules) {
|
|
foreach ($rule in $rules) {
|
|
Write-Output " Rule: $($rule.Name) | Enabled: $($rule.Enabled) | Priority: $($rule.Priority)"
|
|
Write-Output " Description: $($rule.Description)"
|
|
Write-Output " MoveToFolder: $($rule.MoveToFolder)"
|
|
Write-Output " DeleteMessage: $($rule.DeleteMessage)"
|
|
Write-Output " SoftDeleteMessage: $($rule.SoftDeleteMessage)"
|
|
Write-Output ""
|
|
}
|
|
|
|
# Disable any rules that delete messages
|
|
foreach ($rule in $rules) {
|
|
if ($rule.DeleteMessage -or $rule.SoftDeleteMessage -or $rule.MoveToFolder -match "Deleted") {
|
|
Write-Output "[ALERT] Removing problematic rule: $($rule.Name)"
|
|
Remove-InboxRule -Mailbox $lesleyUPN -Identity $rule.Identity -Confirm:$false
|
|
Write-Output "[OK] Removed"
|
|
}
|
|
}
|
|
} else {
|
|
Write-Output " [OK] No inbox rules found"
|
|
}
|
|
|
|
# Check sweep rules
|
|
Write-Output "`n=== SWEEP RULES ==="
|
|
try {
|
|
$sweep = Get-SweepRule -Mailbox $lesleyUPN
|
|
if ($sweep) {
|
|
foreach ($s in $sweep) {
|
|
Write-Output " Rule: $($s.Name) | Enabled: $($s.Enabled)"
|
|
Write-Output " SourceFolder: $($s.SourceFolder)"
|
|
Write-Output " DestFolder: $($s.DestFolder)"
|
|
Write-Output " KeepLatest: $($s.KeepLatest)"
|
|
Write-Output ""
|
|
}
|
|
# Remove sweep rules
|
|
foreach ($s in $sweep) {
|
|
Write-Output "[ALERT] Removing sweep rule: $($s.Name)"
|
|
Remove-SweepRule -Identity $s.Identity -Mailbox $lesleyUPN -Confirm:$false
|
|
Write-Output "[OK] Removed"
|
|
}
|
|
} else {
|
|
Write-Output " [OK] No sweep rules found"
|
|
}
|
|
} catch {
|
|
Write-Output " [INFO] Sweep rules not available: $_"
|
|
}
|
|
|
|
# Check mailbox type and forwarding
|
|
Write-Output "`n=== MAILBOX STATUS ==="
|
|
$mb = Get-Mailbox -Identity $lesleyUPN
|
|
Write-Output " Type: $($mb.RecipientTypeDetails)"
|
|
Write-Output " Forwarding: $($mb.ForwardingAddress)"
|
|
Write-Output " ForwardingSMTP: $($mb.ForwardingSmtpAddress)"
|
|
Write-Output " DeliverToMailboxAndForward: $($mb.DeliverToMailboxAndForward)"
|
|
Write-Output " HiddenFromGAL: $($mb.HiddenFromAddressListsEnabled)"
|
|
Write-Output " LitigationHold: $($mb.LitigationHoldEnabled)"
|
|
|
|
# Check transport rules affecting this mailbox
|
|
Write-Output "`n=== TRANSPORT RULES ==="
|
|
$transport = Get-TransportRule | Where-Object { $_.State -eq "Enabled" }
|
|
if ($transport) {
|
|
foreach ($t in $transport) {
|
|
Write-Output " Rule: $($t.Name) | Priority: $($t.Priority)"
|
|
}
|
|
} else {
|
|
Write-Output " [OK] No transport rules"
|
|
}
|
|
|
|
Disconnect-ExchangeOnline -Confirm:$false
|
|
Write-Output "`n[OK] Done"
|