# ONE CleanupAdmin

Build:

```powershell
dotnet build "Z:\web\Software\Source\ONE\CleanupAdmin\CleanupAdmin.csproj" -c Release
```

Dry-run:

```powershell
& "Z:\web\Software\Source\ONE\CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe" --dry-run --no-pause --log "C:\Drive\Work\ONECleanupAdminCSharp\dry-run.log"
```

Failure checks:

```powershell
& "Z:\web\Software\Source\ONE\CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe" --dry-run --no-elevate
& "Z:\web\Software\Source\ONE\CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe" --dry-run --target-dir C:\Windows
& "Z:\web\Software\Source\ONE\CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe" --dry-run --simulate-registry-access-denied --log "C:\Drive\Work\ONECleanupAdminCSharp\simulated-failure.log"
```

The helper writes a log by default under `%LOCALAPPDATA%\ONE\CleanupAdmin`. Use `--log PATH` to place the log somewhere else. On failure it prints recovery guidance for restarting Explorer, rebooting scheduled deletes, and restoring registry/native messaging entries from backup or reinstall.

The existing `clean-idm-leftovers-admin.cmd` entrypoint calls the helper when present, or runs this project with `dotnet run` from the source tree. It no longer contains the legacy script cleanup fallback.
