How to Uninstall OpenClaw Windows Node: Complete Removal Guide
To completely uninstall openclaw-windows-node, use Windows Add/Remove Programs to trigger the Uninstall-LocalGateway.ps1 script, or run the PowerShell script manually to execute a 13-step cleanup that removes the WSL gateway, tray application, and registry entries.
The openclaw-windows-node repository distributes a Windows tray application that manages a WSL-based gateway service. When you need to remove the software, the built-in uninstaller orchestrates a detailed teardown process through the SetupEngine to ensure no artifacts remain.
What the Uninstall Process Removes
According to the source code in src/OpenClaw.SetupEngine/SetupSteps.cs and src/OpenClaw.SetupEngine/TrayArtifactCleanup.cs, the uninstallation performs seven critical cleanup operations that expand into 13 discrete steps:
-
Stops the gateway service: Executes
systemctl stopinside theOpenClawGatewayWSL distribution. If the service does not terminate within five seconds, the distro is force-unregistered (lines 1501-1531). -
Terminates keep-alive processes: Locates and kills any background processes started by the tray client (lines 2781-2828).
-
Deletes gateway identity files: Removes the per-gateway directory under
%APPDATA%\OpenClawTray\gateways\<gateway-id>\(lines 1943-1952). -
Handles token files: By default, device token files are preserved for potential reinstallation. Use specific flags to override this behavior (lines 1962-1969, 2344-2351).
-
Removes autostart registry key: Deletes
HKCU\Software\Microsoft\Windows\CurrentVersion\Run\OpenClawTray(lines 30-39 inTrayArtifactCleanup.cs). -
Deletes file system artifacts: Recursively removes the installation directory, WSL VHD parent folder, and empty
%APPDATA%\OpenClawTraysub-folders (lines 850-858, 1100-1120). -
Resets onboarding settings: Clears gateway URL and mode flags in
settings.jsonto trigger the onboarding wizard on next run (lines 160-170).
Three Methods to Uninstall OpenClaw Windows Node
Method 1: Windows Add/Remove Programs (Recommended)
The simplest approach uses the standard Windows uninstall UI. Navigate to Control Panel → Programs → Uninstall a program or Settings → Apps, select OpenClaw Tray, and click Uninstall.
This launches the Inno Setup uninstaller, which executes scripts/Uninstall-LocalGateway.ps1. The script dot-sources scripts/_uninstall-helpers.ps1, which provides validation functions like Test-IsOpenClawOwnedDistroName to ensure only the OpenClawGateway distro is targeted.
Method 2: PowerShell Command Line
For automated deployments or when the UI entry is missing, run the uninstall script directly:
# Run from an elevated PowerShell session
$uninstallScript = "$env:ProgramFiles\OpenClaw\Uninstall-LocalGateway.ps1"
& $uninstallScript -DryRun:$false
The -DryRun parameter allows you to preview actions without executing them. The script logs all steps to %TEMP%\OpenClaw-Uninstall.log and uses helper functions including Invoke-WslCommand for WSL interaction and Stop-OpenClawProcessByPid for process termination.
Method 3: CLI Tool
The OpenClaw.WinNode.Cli.exe executable exposes an uninstall sub-command that forwards to the SetupEngine:
OpenClaw.WinNode.Cli.exe uninstall --confirm-destructive
The --confirm-destructive flag is required to prevent accidental execution. According to src/OpenClaw.Tray.WinUI/CliUninstallHandler.cs, this entry point invokes SetupPipeline.UninstallAsync, which ultimately triggers the same PowerShell script as the other methods.
Verifying Complete Removal
After uninstallation, confirm completion by checking the log file and WSL status:
# View the uninstall log
Get-Content "$env:TEMP\OpenClaw-Uninstall.log"
# Verify the WSL distribution is removed
wsl -l -v
The log should show entries like [Uninstall] Deleted VHD parent directory and [Uninstall] Reset onboarding settings. The OpenClawGateway distribution should no longer appear in the WSL list.
Technical Architecture of the Uninstall Process
The uninstallation is orchestrated by the SetupEngine, implemented in src/OpenClaw.SetupEngine/SetupPipeline.cs. The UninstallAsync method executes a 13-step sequence defined in SetupSteps.cs, ensuring consistent behavior across all entry points.
The PowerShell layer in scripts/_uninstall-helpers.ps1 provides:
- Distro validation:
Test-IsOpenClawOwnedDistroNameconfirms the target is exactlyOpenClawGateway - Safe process termination:
Stop-OpenClawProcessByPidkills PIDs without throwing errors for missing processes - Dry-run support:
Assert-DryRunGateprevents destructive operations during validation
This architecture ensures that whether you uninstall via UI, PowerShell, or CLI, the same cleanup logic defined in the C# implementation runs consistently.
Summary
Uninstalling openclaw-windows-node requires executing the SetupEngine's 13-step cleanup sequence. Key takeaways:
- Use Windows Add/Remove Programs for the standard experience, which runs
Uninstall-LocalGateway.ps1automatically - Run PowerShell directly with
-DryRun:$falsefor scripted or offline uninstalls - Device tokens are preserved by default to allow seamless reinstallation, while the WSL gateway and registry keys are always removed
- Check
%TEMP%\OpenClaw-Uninstall.logto verify all steps completed, including the removal of theOpenClawGatewayWSL distro and autostart registry entry
Frequently Asked Questions
Does uninstalling openclaw-windows-node delete my device tokens?
No. By default, the uninstaller preserves device token files so you can reinstall without reconfiguring credentials. According to src/OpenClaw.SetupEngine/SetupSteps.cs (lines 1962-1969), tokens are only deleted if you specify flags to remove them explicitly.
What happens if the WSL gateway service does not stop within 5 seconds?
If systemctl stop fails to terminate the service within five seconds, the uninstaller force-unregisters the entire OpenClawGateway WSL distribution. This logic appears in src/OpenClaw.SetupEngine/SetupSteps.cs (lines 1501-1531) to prevent hung processes from blocking removal.
Can I preview what the uninstall will do before executing it?
Yes. Run the PowerShell script with -DryRun:$true to execute the validation logic without performing destructive operations. The Assert-DryRunGate function in scripts/_uninstall-helpers.ps1 intercepts deletion commands and logs them instead of executing them.
Why does the CLI tool require the --confirm-destructive flag?
The flag protects against accidental data loss when using OpenClaw.WinNode.Cli.exe. As implemented in src/OpenClaw.Tray.WinUI/CliUninstallHandler.cs, this requirement ensures you explicitly acknowledge that the command will remove the gateway and associated configuration files.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →