{"id":1742,"date":"2025-11-09T23:45:37","date_gmt":"2025-11-09T23:45:37","guid":{"rendered":"https:\/\/www.ultrexstaff.com\/?p=1742"},"modified":"2025-11-09T23:45:37","modified_gmt":"2025-11-09T23:45:37","slug":"how-to-uninstall-the-atera-agent-by-powershell-script","status":"publish","type":"post","link":"https:\/\/www.ultrexstaff.com\/?p=1742","title":{"rendered":"How to uninstall the Atera agent by Powershell Script"},"content":{"rendered":"\n<p>How to uninstall the&nbsp;Atera&nbsp;agent by&nbsp;Powershell&nbsp;Script&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/support.atera.com\/hc\/en-us\/articles\/5849002658844-How-do-I-remove-the-Atera-Agent-after-my-trial-has-expired\n<\/div><\/figure>\n\n\n\n<p>Regarding&nbsp;your query, what&nbsp;I would recommend, after&nbsp;you rename the&nbsp;PC, make&nbsp;sure to reboot it.\u202f&nbsp;<\/p>\n\n\n\n<p>After that, I would recommend&nbsp;to run&nbsp;the following script using PowerShell ISE as admin,&nbsp;locally :\u202f&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/support.atera.com\/hc\/en-us\/articles\/5849002658844-How-do-I-remove-the-Atera-Agent-after-my-trial-has-expired\n<\/div><\/figure>\n\n\n\n<p>Once the script is finished, reboot the&nbsp;device again.&nbsp;In order for&nbsp;the registry keys to be removed \/ updated, reboot would be needed.\u202f&nbsp;<\/p>\n\n\n\n<p>After this, I would recommend using the CMD installation method instead of .MSI in order to install&nbsp;Atera&nbsp;Agent and assign it to the right customer.&nbsp;<\/p>\n\n\n\n<p>Function Get-UninstallCodes&nbsp;([string]$DisplayName) {&nbsp;<\/p>\n\n\n\n<p>&#8216;HKLM:SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall&#8217;, &#8216;HKLM:SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall&#8217; |&nbsp;ForEach-Object {&nbsp;<\/p>\n\n\n\n<p>Get-ChildItem&nbsp;-Path $_ -ErrorAction&nbsp;SilentlyContinue&nbsp;|&nbsp;ForEach-Object {&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $(Get-ItemProperty&nbsp;-Path $_.PSPath&nbsp;-Name &#8216;DisplayName&#8217; -ErrorAction&nbsp;SilentlyContinue) -and ($(Get-ItemPropertyValue&nbsp;-Path $_.PSPath&nbsp;-Name &#8216;DisplayName&#8217; -ErrorAction&nbsp;SilentlyContinue) -eq $DisplayName) )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>$str = (Get-ItemPropertyValue&nbsp;-Path $_.PSPath&nbsp;-Name &#8216;UninstallString&#8217;)&nbsp;<\/p>\n\n\n\n<p>$UninstallCodes.Add($str.Substring(($str.Length&nbsp;&#8211; 37),36)) | Out-Null&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Get-ProductKeys&nbsp;([string]$ProductName) {&nbsp;<\/p>\n\n\n\n<p>Get-ChildItem&nbsp;-Path &#8216;HKCR:Installer\\Products&#8217; |&nbsp;ForEach-Object {&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $(Get-ItemProperty&nbsp;-Path $_.PSPath&nbsp;-Name &#8216;ProductName&#8217; -ErrorAction&nbsp;SilentlyContinue) -and ($(Get-ItemPropertyValue&nbsp;-Path $_.PSPath&nbsp;-Name &#8216;ProductName&#8217; -ErrorAction&nbsp;SilentlyContinue) -eq $ProductName) )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>$ProductKeys.Add($_.PSPath.Substring(($_.PSPath.Length&nbsp;&#8211; 32))) | Out-Null&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Get-ServiceStatus&nbsp;([string]$Name)&nbsp;{ (Get-Service -Name $Name -ErrorAction&nbsp;SilentlyContinue).Status&nbsp;}&nbsp;<\/p>\n\n\n\n<p>Function Stop-RunningService&nbsp;([string]$Name) {&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $(Get-ServiceStatus&nbsp;-Name $Name) -eq &#8220;Running&#8221; )&nbsp;{ Write-Output &#8220;Stopping :&nbsp;${Name} service&#8221; ;&nbsp;Stop-Service -Name $Name -Force }&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Remove-StoppedService&nbsp;([string]$Name) {&nbsp;<\/p>\n\n\n\n<p>$s = (Get-ServiceStatus&nbsp;-Name $Name)&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $s )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $s -eq &#8220;Stopped&#8221; )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>Write-Output &#8220;Deleting :&nbsp;${Name} service&#8221;&nbsp;<\/p>\n\n\n\n<p>Start-Process &#8220;sc.exe&#8221; -ArgumentList&nbsp;&#8220;delete ${Name}&#8221; -Wait&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>} Else&nbsp;{ Write-Output &#8220;Not Found: ${Name} service&#8221; }&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Stop-RunningProcess&nbsp;([string]$Name) {&nbsp;<\/p>\n\n\n\n<p>$p = (Get-Process -Name $_ -ErrorAction&nbsp;SilentlyContinue)&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( $p )&nbsp;{ Write-Output &#8220;Stopping :&nbsp;${Name}.exe&#8221; ;&nbsp;$p | Stop-Process -Force }&nbsp;<\/p>\n\n\n\n<p>Else&nbsp;{ Write-Output &#8220;Not Found: ${Name}.exe is not running&#8221;}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Remove-Path ([string]$Path) {&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( Test-Path $Path )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>Write-Output &#8220;Deleting :&nbsp;${Path}&#8221;&nbsp;<\/p>\n\n\n\n<p>Remove-Item $Path -Recurse -Force&nbsp;<\/p>\n\n\n\n<p>} Else&nbsp;{ Write-Output &#8220;Not Found: ${Path}&#8221; }&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>Function Get-AllExeFiles&nbsp;([string]$Path) {&nbsp;<\/p>\n\n\n\n<p>If&nbsp;( Test-Path $Path )&nbsp;{&nbsp;<\/p>\n\n\n\n<p>Get-ChildItem&nbsp;-Path $Path -Filter *.exe -Recurse |&nbsp;ForEach-Object { $ExeFiles.Add($_.BaseName) | Out-Null }&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p>}&nbsp;<\/p>\n\n\n\n<p># Mount HKEY_CLASSES_ROOT registry hive&nbsp;<\/p>\n\n\n\n<p>New-PSDrive&nbsp;-Name HKCR -PSProvider&nbsp;Registry -Root HKEY_CLASSES_ROOT | Out-Null&nbsp;<\/p>\n\n\n\n<p>#######&nbsp;<\/p>\n\n\n\n<p># START: Information gathering&nbsp;<\/p>\n\n\n\n<p>#######&nbsp;<\/p>\n\n\n\n<p># Get MSI package codes from the uninstall key&nbsp;<\/p>\n\n\n\n<p>$UninstallCodes&nbsp;= New-Object&nbsp;System.Collections.ArrayList&nbsp;<\/p>\n\n\n\n<p>&#8216;AteraAgent&#8217;, &#8216;Splashtop&nbsp;for RMM&#8217;, &#8216;Splashtop&nbsp;Streamer&#8217; |&nbsp;ForEach-Object&nbsp;{ Get-UninstallCodes&nbsp;-DisplayName $_ }&nbsp;<\/p>\n\n\n\n<p># Get product keys from the list of installed products&nbsp;<\/p>\n\n\n\n<p>$ProductKeys&nbsp;= New-Object&nbsp;System.Collections.ArrayList&nbsp;<\/p>\n\n\n\n<p>&#8216;AteraAgent&#8217;, &#8216;Splashtop&nbsp;for RMM&#8217;, &#8216;Splashtop&nbsp;Streamer&#8217; |&nbsp;ForEach-Object&nbsp;{ Get-ProductKeys&nbsp;-ProductName $_ }&nbsp;<\/p>\n\n\n\n<p># Define all the directories&nbsp;we&#8217;ll&nbsp;need to cleanup at the end of this script&nbsp;<\/p>\n\n\n\n<p>$Directories =&nbsp;@(&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles}\\ATERA Networks&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles(x86)}\\ATERA Networks&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles}\\Splashtop\\Splashtop&nbsp;Remote\\Server&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles(x86)}\\Splashtop\\Splashtop&nbsp;Remote\\Server&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles}\\Splashtop\\Splashtop&nbsp;Software Updater&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles(x86)}\\Splashtop\\Splashtop&nbsp;Software Updater&#8221;,&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramData}\\Splashtop\\Splashtop&nbsp;Software Updater&#8221;&nbsp;<\/p>\n\n\n\n<p>)&nbsp;<\/p>\n\n\n\n<p># Get all possible relevant exe files so we can make sure&nbsp;they&#8217;re&nbsp;closed&nbsp;later on&nbsp;<\/p>\n\n\n\n<p>$ExeFiles&nbsp;= New-Object&nbsp;System.Collections.ArrayList&nbsp;<\/p>\n\n\n\n<p>&#8220;${Env:ProgramFiles}\\ATERA Networks&#8221; |&nbsp;ForEach-Object&nbsp;{ Get-AllExeFiles&nbsp;-Path $_ }&nbsp;<\/p>\n\n\n\n<p># Define a list of services we need to stop and&nbsp;delete&nbsp;(if necessary)&nbsp;<\/p>\n\n\n\n<p>$ServiceList&nbsp;=&nbsp;@(&nbsp;<\/p>\n\n\n\n<p>&#8216;AteraAgent&#8217;,&nbsp;<\/p>\n\n\n\n<p>&#8216;SplashtopRemoteService&#8217;,&nbsp;<\/p>\n\n\n\n<p>&#8216;SSUService&#8217;&nbsp;<\/p>\n\n\n\n<p>)&nbsp;<\/p>\n\n\n\n<p># Define a list of registry keys&nbsp;we&#8217;ll&nbsp;delete&nbsp;<\/p>\n\n\n\n<p>$RegistryKeys&nbsp;=&nbsp;@(&nbsp;<\/p>\n\n\n\n<p>&#8216;HKLM:SOFTWARE\\ATERA Networks&#8217;,&nbsp;<\/p>\n\n\n\n<p>&#8216;HKLM:SOFTWARE\\Splashtop&nbsp;Inc.&#8217;,&nbsp;<\/p>\n\n\n\n<p>&#8216;HKLM:SOFTWARE\\WOW6432Node\\Splashtop&nbsp;Inc.&#8217;&nbsp;<\/p>\n\n\n\n<p>)&nbsp;<\/p>\n\n\n\n<p>#######&nbsp;<\/p>\n\n\n\n<p># END: Information gathering&nbsp;<\/p>\n\n\n\n<p>#######&nbsp;<\/p>\n\n\n\n<p># Uninstall each MSI package code in $UninstallCodes&nbsp;<\/p>\n\n\n\n<p>$UninstallCodes&nbsp;|&nbsp;ForEach-Object&nbsp;{ Write-Output &#8220;Uninstall: ${_}&#8221; ;&nbsp;Start-Process &#8220;msiexec.exe&#8221; -ArgumentList&nbsp;&#8220;\/X{${_}} \/qn&#8221; -Wait }&nbsp;<\/p>\n\n\n\n<p># Stop services if&nbsp;they&#8217;re&nbsp;still running&nbsp;<\/p>\n\n\n\n<p>$ServiceList&nbsp;|&nbsp;ForEach-Object&nbsp;{ Stop-RunningService&nbsp;-Name $_ }&nbsp;<\/p>\n\n\n\n<p>#&nbsp;Terminate&nbsp;all relevant processes that may still be running&nbsp;<\/p>\n\n\n\n<p>$ExeFiles.Add(&#8216;reg&#8217;) |&nbsp;Out-Null&nbsp;<\/p>\n\n\n\n<p>$ExeFiles&nbsp;|&nbsp;ForEach-Object&nbsp;{ Stop-RunningProcess&nbsp;$_ }&nbsp;<\/p>\n\n\n\n<p>#&nbsp;Delete&nbsp;services if&nbsp;they&#8217;re&nbsp;still present&nbsp;<\/p>\n\n\n\n<p>$ServiceList&nbsp;|&nbsp;ForEach-Object&nbsp;{ Remove-StoppedService&nbsp;-Name $_ }&nbsp;<\/p>\n\n\n\n<p>#&nbsp;Delete&nbsp;products from MSI installer registry&nbsp;<\/p>\n\n\n\n<p>$ProductKeys&nbsp;|&nbsp;ForEach-Object&nbsp;{ Remove-Path -Path &#8220;HKCR:Installer\\Products\\${_}&#8221; }&nbsp;<\/p>\n\n\n\n<p># Unmount HKEY_CLASSES_ROOT registry hive&nbsp;<\/p>\n\n\n\n<p>Remove-PSDrive&nbsp;-Name HKCR&nbsp;<\/p>\n\n\n\n<p>#&nbsp;Delete&nbsp;registry keys&nbsp;<\/p>\n\n\n\n<p>$RegistryKeys&nbsp;|&nbsp;ForEach-Object&nbsp;{ Remove-Path -Path $_ }&nbsp;<\/p>\n\n\n\n<p>#&nbsp;Delete&nbsp;remaining directories&nbsp;<\/p>\n\n\n\n<p>#Write-Host &#8220;Waiting for file locks to be freed&#8221; ;&nbsp;Start-Sleep -Seconds 4&nbsp;<\/p>\n\n\n\n<p>$Directories |&nbsp;ForEach-Object&nbsp;{ Remove-Path -Path $_ }&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to uninstall the&nbsp;Atera&nbsp;agent by&nbsp;Powershell&nbsp;Script&nbsp; Regarding&nbsp;your query, what&nbsp;I would recommend, after&nbsp;you rename the&nbsp;PC, make&nbsp;sure to reboot it.\u202f&nbsp; After that, I would recommend&nbsp;to run&nbsp;the following script using PowerShell ISE as admin,&nbsp;locally :\u202f&nbsp; Once the script is finished, reboot the&nbsp;device again.&nbsp;In order for&nbsp;the registry keys to be removed \/ updated, reboot would be needed.\u202f&nbsp; After this, I [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[123,124,98,113,120],"tags":[],"class_list":["post-1742","post","type-post","status-publish","format-standard","hentry","category-atera","category-command-line","category-it-knowledge-base-articles","category-servers","category-windows","post-preview"],"_links":{"self":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1742","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1742"}],"version-history":[{"count":1,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1742\/revisions"}],"predecessor-version":[{"id":1743,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=\/wp\/v2\/posts\/1742\/revisions\/1743"}],"wp:attachment":[{"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ultrexstaff.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}