diff --git a/Uninstall-AteraAgent.ps1 b/Uninstall-AteraAgent.ps1 index 1fe4635..367d1e5 100644 --- a/Uninstall-AteraAgent.ps1 +++ b/Uninstall-AteraAgent.ps1 @@ -62,39 +62,25 @@ New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | Out-Null # Get MSI package codes from the uninstall key $UninstallCodes = New-Object System.Collections.ArrayList -'AteraAgent', 'Splashtop for RMM', 'Splashtop Streamer' | ForEach-Object { Get-UninstallCodes -DisplayName $_ } +'AteraAgent' | ForEach-Object { Get-UninstallCodes -DisplayName $_ } # Get product keys from the list of installed products $ProductKeys = New-Object System.Collections.ArrayList -'AteraAgent', 'Splashtop for RMM', 'Splashtop Streamer' | ForEach-Object { Get-ProductKeys -ProductName $_ } +'AteraAgent' | ForEach-Object { Get-ProductKeys -ProductName $_ } # Define all the directories we'll need to cleanup at the end of this script -$Directories = @( - "${Env:ProgramFiles}\ATERA Networks", - "${Env:ProgramFiles}\Splashtop\Splashtop Remote\Server", - "${Env:ProgramFiles(x86)}\Splashtop\Splashtop Remote\Server", - "${Env:ProgramFiles}\Splashtop\Splashtop Software Updater", - "${Env:ProgramFiles(x86)}\Splashtop\Splashtop Software Updater", - "${Env:ProgramData}\Splashtop\Splashtop Software Updater" -) +$Directories = @("${Env:ProgramFiles}\ATERA Networks") # Get all possible relevant exe files so we can make sure they're closed later on $ExeFiles = New-Object System.Collections.ArrayList -"${Env:ProgramFiles}\ATERA Networks" | ForEach-Object { Get-AllExeFiles -Path $_ } +$Directories | ForEach-Object { Get-AllExeFiles -Path $_ } +$ExeFiles.Add('reg') | Out-Null # Define a list of services we need to stop and delete (if necessary) -$ServiceList = @( - 'AteraAgent', - 'SplashtopRemoteService', - 'SSUService' -) +$ServiceList = @('AteraAgent') # Define a list of registry keys we'll delete -$RegistryKeys = @( - 'HKLM:SOFTWARE\ATERA Networks', - 'HKLM:SOFTWARE\Splashtop Inc.', - 'HKLM:SOFTWARE\WOW6432Node\Splashtop Inc.' -) +$RegistryKeys = @('HKLM:SOFTWARE\ATERA Networks') ####### # END: Information gathering @@ -107,7 +93,6 @@ $UninstallCodes | ForEach-Object { Write-Output "Uninstall: ${_}" ; Start-Proces $ServiceList | ForEach-Object { Stop-RunningService -Name $_ } # Terminate all relevant processes that may still be running -$ExeFiles.Add('reg') | Out-Null $ExeFiles | ForEach-Object { Stop-RunningProcess $_ } # Delete services if they're still present @@ -124,8 +109,3 @@ $RegistryKeys | ForEach-Object { Remove-Path -Path $_ } # Delete remaining directories $Directories | ForEach-Object { Remove-Path -Path $_ } - -# Atera's original script also deleted the following directories and registry keys -# However, since they are user specific and this script needs to run with admin credentials, I've left them commented out -# If you want to include them, just uncomment the line below: -#"${Env:LocalAppData}\Temp\TrayIconCaching", 'HKCU:SOFTWARE\ATERA Networks' | ForEach-Object { Remove-Path -Path $_ }