Synopsis
Fully removes the LabTech (ConnectWise Automate) agent from the local machine, including services, files, and registry keys.Description
Uninstall-LTService performs a thorough removal of the ConnectWise Automate agent:
- Stops all running LabTech services (
LTService,LTSvcMon,LabVNC). - Downloads the current agent installer MSI from the server and runs an MSI uninstall (
msiexec /x). - Downloads and runs
Agent_Uninstall.exe(LabUninstall.exe) from the server to perform a deep clean. On Automate 2025 and later, the extractedUninstall.exesub-process is also executed. - Removes all remaining LabTech services via
sc.exe delete. - Deletes the agent file directory (
%windir%\LTSVCby default) and the%windir%\temp\_ltupdatefolder. - Removes all known LabTech registry keys across
HKLM,HKCU,HKCR, andHKU.
Get-LTServiceInfo. If the server is unreachable, it falls back to downloading Agent_Uninstall.exe from the ConnectWise S3 assets bucket.
Syntax
Parameters
The URL to the LabTech/Automate server. Used to download the uninstall utilities
(
RemoteAgent.msi and Agent_Uninstall.exe).If not provided, the function reads the server address from the registry using
Get-LTServiceInfo. If that also fails, it prompts interactively.Accepts pipeline input by property name.Example: https://lt.domain.comIf specified, runs
New-LTServiceBackup before beginning the uninstall process.
This preserves current agent settings (server, location, password hash) so they
can be recovered later by Redo-LTService via Get-LTServiceInfoBackup.Allows the uninstall to proceed even if the agent is detected as a probe agent.
Without this switch, the function throws a terminating error when a probe is detected.
Shows what actions would be performed without actually executing them. No files are
downloaded or removed.
Prompts for confirmation before executing each significant action (file downloads,
MSI uninstall, service removal, file/registry deletion).
Examples
Uninstall using the server address stored in the registry:Uninstall with an explicit server URL:
Notes
- Uninstall files are downloaded to
%windir%\Temp\and cleaned up after the process completes. - If the MSI or uninstaller EXE cannot be downloaded from the server (e.g., server is offline),
Agent_Uninstall.exeis retrieved from the ConnectWise public S3 bucket as a fallback. - After uninstall, the function checks for remnants. If
%windir%\ltsvc,%windir%\temp\_ltupdate, or the LabTech registry keys still exist, a warning is written recommending a reboot and retry. - To restore the agent after an uninstall, use
Redo-LTServiceorInstall-LTService.