# Clean shortcuts from Default profile (stops future new users getting dupes)
Remove-Item "C:\Users\Default\Desktop\ALIS.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\Default\Desktop\LinkRx.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\Default\Desktop\Helpany.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\Default\Desktop\PharmCare.url" -Force -ErrorAction SilentlyContinue
Write-Output "Cleaned Default profile desktop"

# Clean pilot.test per-user desktop
Remove-Item "C:\Users\pilot.test\Desktop\ALIS.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\pilot.test\Desktop\LinkRx.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\pilot.test\Desktop\Helpany.url" -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Users\pilot.test\Desktop\PharmCare.url" -Force -ErrorAction SilentlyContinue
Write-Output "Cleaned pilot.test desktop"

# Clean any other user desktops that might have copies
Get-ChildItem "C:\Users" -Directory | Where-Object { $_.Name -notin 'Public','Default','Default User','All Users' } | ForEach-Object {
    $desk = Join-Path $_.FullName "Desktop"
    $removed = 0
    foreach ($f in 'ALIS.url','Helpany.url','PharmCare.url','LinkRx.url') {
        $p = Join-Path $desk $f
        if (Test-Path $p) { Remove-Item $p -Force; $removed++ }
    }
    if ($removed -gt 0) { Write-Output "Cleaned $removed shortcuts from $($_.Name)" }
}

# Verify
Write-Output ""
Write-Output "=== Public Desktop (canonical, all users see these) ==="
Get-ChildItem "C:\Users\Public\Desktop\*" | ForEach-Object { Write-Output "  $($_.Name)" }
Write-Output "=== Default Desktop (empty now) ==="
Get-ChildItem "C:\Users\Default\Desktop\*" -ErrorAction SilentlyContinue | ForEach-Object { Write-Output "  $($_.Name)" }
Write-Output "=== pilot.test Desktop ==="
Get-ChildItem "C:\Users\pilot.test\Desktop\*" -ErrorAction SilentlyContinue | ForEach-Object { Write-Output "  $($_.Name)" }
