# Remove stale Edge profile data for the current pilot.test user
$edgePath = "C:\Users\pilot.test\AppData\Local\Microsoft\Edge\User Data"
if (Test-Path $edgePath) {
    # Kill Edge first
    Get-Process msedge -ErrorAction SilentlyContinue | Stop-Process -Force
    Start-Sleep -Seconds 2
    Remove-Item $edgePath -Recurse -Force -ErrorAction SilentlyContinue
    Write-Output "Cleared Edge profile data for pilot.test"
} else {
    Write-Output "No Edge profile data for pilot.test"
}
gpupdate /force /wait:60 2>&1 | Out-Null
Write-Output "gpupdate done"
