# Change 007: Uninstall AnyDesk During Install

## Summary
The NSIS installer should detect and handle existing AnyDesk installations:
1. If "AnyDesk NetExperts Support" (our branded AnyDesk) is found → silently uninstall it
2. If other AnyDesk versions are found → prompt user whether to uninstall

## Implementation
In the NSIS installer script, add a pre-install section that:

### Step 1: Detect AnyDesk installations
Check the registry for AnyDesk entries:
- `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*`
- `HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*`
- Look for DisplayName containing "AnyDesk"

### Step 2: Classify
- If DisplayName contains "AnyDesk" AND "NetExperts" → branded, auto-remove
- If DisplayName contains "AnyDesk" but NOT "NetExperts" → third-party, ask user

### Step 3: Uninstall
- Read UninstallString from the registry entry
- For branded AnyDesk: run uninstaller silently (`/S` flag)
- For other AnyDesk: show MessageBox asking "AnyDesk is installed. Would you like to remove it? NetExperts Support replaces AnyDesk." If yes, run uninstaller.
- Stop AnyDesk service first if running

## Risk Assessment
- **Breaking risk**: Medium — touching other software's uninstall
- **Regression areas**: Install flow, AnyDesk service state, user data

## Test Cases
1. Install with branded AnyDesk present → silently removed, NetExperts installs
2. Install with generic AnyDesk present → user prompted, both outcomes work
3. Install with no AnyDesk → no prompt, clean install
4. Install with AnyDesk running → service stopped before uninstall
5. AnyDesk uninstall fails gracefully → NetExperts still installs with warning
6. Multiple AnyDesk entries → each handled correctly
