# BG Builders - Verify Lesley Device Wipe Status $ErrorActionPreference = "Stop" $tenantId = "ededa4fb-f6eb-4398-851d-5eb3e11fab27" $lesleyUPN = "lesley@bgbuildersllc.com" Write-Output "=========================================" Write-Output " Verify Device Wipe - Lesley Roth" Write-Output " $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')" Write-Output "=========================================" # --- Check Intune Managed Devices --- Write-Output "`n[CHECK 1] Intune Managed Devices..." Import-Module Microsoft.Graph.Authentication Import-Module Microsoft.Graph.DeviceManagement Connect-MgGraph -TenantId $tenantId -Scopes 'DeviceManagementManagedDevices.Read.All' -NoWelcome Write-Output "[OK] Connected to Graph" $devices = Get-MgDeviceManagementManagedDevice -Filter "userPrincipalName eq '$lesleyUPN'" 2>$null if ($devices) { foreach ($d in $devices) { Write-Output "" Write-Output " Device: $($d.DeviceName)" Write-Output " OS: $($d.OperatingSystem) $($d.OsVersion)" Write-Output " Compliance: $($d.ComplianceState)" Write-Output " Management State: $($d.ManagementState)" Write-Output " Last Sync: $($d.LastSyncDateTime)" Write-Output " Device Action: $($d.DeviceActionResults | ForEach-Object { "$($_.ActionName): $($_.ActionState)" })" } } else { Write-Output " [INFO] No Intune-managed devices found for $lesleyUPN" } Disconnect-MgGraph # --- Check EAS Devices --- Write-Output "`n[CHECK 2] Exchange ActiveSync Devices..." Import-Module ExchangeOnlineManagement Connect-ExchangeOnline -UserPrincipalName "sysadmin@bgbuildersllc.com" -ShowBanner:$false Write-Output "[OK] Connected to Exchange Online" $easDevices = Get-MobileDevice -Mailbox $lesleyUPN 2>$null if ($easDevices) { foreach ($eas in $easDevices) { $stats = Get-MobileDeviceStatistics -Identity $eas.Identity 2>$null Write-Output "" Write-Output " Device: $($eas.FriendlyName)" Write-Output " Type: $($eas.DeviceType)" Write-Output " OS: $($eas.DeviceOS)" Write-Output " Access State: $($eas.DeviceAccessState)" Write-Output " First Sync: $($eas.FirstSyncTime)" if ($stats) { Write-Output " Last Sync: $($stats.LastSuccessSync)" Write-Output " Wipe Status: $($stats.DeviceWipeSentTime)" Write-Output " Wipe Ack: $($stats.DeviceWipeAckTime)" Write-Output " Status: $($stats.Status)" } } } else { Write-Output " [INFO] No EAS devices found for $lesleyUPN" } # --- Check account status --- Write-Output "`n[CHECK 3] Account Status..." $mbx = Get-Mailbox -Identity $lesleyUPN -ErrorAction SilentlyContinue if ($mbx) { Write-Output " Mailbox Type: $($mbx.RecipientTypeDetails)" Write-Output " Litigation Hold: $($mbx.LitigationHoldEnabled)" } Disconnect-ExchangeOnline -Confirm:$false Write-Output "`n[OK] Verification complete"