Skip to content

Instantly share code, notes, and snippets.

@ak9999
Created September 21, 2019 23:48
Show Gist options
  • Save ak9999/e68da02d7957bd7db2a2a647f76d50be to your computer and use it in GitHub Desktop.
Save ak9999/e68da02d7957bd7db2a2a647f76d50be to your computer and use it in GitHub Desktop.
Uninstall LabTech and ScreenConnect Agents: For those who are having a hard time uninstalling the LabTech Agent from their computer, the first script will remove the LabTech Agent, and the second will remove ScreenConnect aka (ConnectWise Control).
$url = "https://s3.amazonaws.com/assets-cp/assets/Agent_Uninstaller.zip"
$output = "C:\Windows\Temp\Agent_Uninstaller.zip"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
# The below usage of Expand-Archive is only possible with PowerShell 5.0+
# Expand-Archive -LiteralPath C:\Windows\Temp\Agent_Uninstaller.zip -DestinationPath C:\Windows\Temp\LTAgentUninstaller -Force
# Use .NET instead
[System.Reflection.Assembly]::LoadWithPartialName("System.IO.Compression.FileSystem") | Out-Null
# Now we can expand the archive
[System.IO.Compression.ZipFile]::ExtractToDirectory('C:\Windows\Temp\Agent_Uninstaller.zip', 'C:\Windows\Temp\LTAgentUninstaller')
Start-Process -FilePath "C:\Windows\Temp\LTAgentUninstaller\Agent_Uninstall.exe"
wmic product where "name like 'ScreenConnect Client%%'" call uninstall /nointeractive
@sbouillon
Copy link

Thank you! We'll let you know when it's no longer working so you can get a small taste of the MSP space again :)

@EmpireConsultants
Copy link

If you get the following error with System.Net.Webclient:
The request was aborted could not create ssl/tls secure channel

Just add this to the top of the script
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

@FarVision2
Copy link

Still works :)
MSPs still exiting clients without proper cleanup.

@ZSchwarttzy
Copy link

Might be slower, but that that "Agent_Uninstaller.exe" is basically just a zip file. Use 7-zip, or whatever, to open the file and pull out both that Uninstall.exe and the Uninstall.exe.config files. Put those in the same location and run the Uninstall.exe. Takes a moment but should still do the trick.

labtech uninstaller

@ScottMonolith
Copy link

Went through writing a script to identify the uninstall string in the registry and found that it didn't do squat. This script, however, still delivers in 2025. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment