# BG Builders - Lesley Exchange steps (run from interactive PowerShell) # Adds Shelly as delegate + enables litigation hold $lesleyUPN = "lesley@bgbuildersllc.com" $shellyUPN = "Shelly@bgbuildersllc.com" Write-Output "Connecting to Exchange Online..." Import-Module ExchangeOnlineManagement Connect-ExchangeOnline -UserPrincipalName "sysadmin@bgbuildersllc.com" -ShowBanner:$false Write-Output "[OK] Connected" # Add Shelly as delegate Write-Output "`nAdding Shelly as delegate..." Add-MailboxPermission -Identity $lesleyUPN -User $shellyUPN -AccessRights FullAccess -AutoMapping $true Write-Output "[OK] Shelly granted FullAccess" Add-RecipientPermission -Identity $lesleyUPN -Trustee $shellyUPN -AccessRights SendAs -Confirm:$false Write-Output "[OK] Shelly granted SendAs" # Enable litigation hold Write-Output "`nEnabling litigation hold..." Set-Mailbox -Identity $lesleyUPN -LitigationHoldEnabled $true -LitigationHoldDuration Unlimited Write-Output "[OK] Litigation hold enabled" # Verify Write-Output "`nVerifying permissions..." Get-MailboxPermission -Identity $lesleyUPN | Where-Object { $_.User -notlike "NT AUTHORITY*" -and $_.User -notlike "S-1-*" } | Format-Table User,AccessRights -AutoSize Write-Output "`nVerifying litigation hold..." Get-Mailbox -Identity $lesleyUPN | Format-List LitigationHoldEnabled,LitigationHoldDuration Disconnect-ExchangeOnline -Confirm:$false Write-Output "[OK] Done"