US English (US)
FR French
DE German
ES Spanish
IT Italian
NL Dutch
JP Japanese

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

  • Contact Us
Italian
US English (US)
FR French
DE German
ES Spanish
IT Italian
NL Dutch
JP Japanese
  • Home
  • Knowledgebase AutoElevate
  • Integrazioni
  • Integrazioni di strumenti RMM e distribuzione automatizzata

Disinstallazione dell'agente tramite PowerShell

Come utilizzare PowerShell per disinstallare l'agente AutoElevate

Written by Chris Liles

Updated at June 10th, 2025

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

  • Knowledgebase AutoElevate
    Nuovo su AutoElevate ? INIZIA QUI Generale e risoluzione dei problemi Gestione delle regole Integrazioni Annunci Domande frequenti Video tutorial
  • Base di conoscenza Password Boss
    Utilizzo Password Boss Amministrazione Aziendale Documenti del partner Password Boss
  • Kit di strumenti di marketing
    Kit di strumenti per il marketing e la formazione MSP
  • Changelog per Autoelevate e Password Boss
  • Stato attuale
+ More

Occasionalmente, l'agente AutoElevate potrebbe non essere installato correttamente e potrebbe essere necessario rimuoverlo quando il processo consueto fallisce. Di seguito è riportato uno script di PowerShell per rimuovere correttamente l'agente.

Scarica lo script PowerShell

# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#    * Redistributions of source code must retain the above copyright
#      notice, this list of conditions and the following disclaimer.
#    * Redistributions in binary form must reproduce the above copyright
#      notice, this list of conditions and the following disclaimer in the
#      documentation and/or other materials provided with the distribution.
#    * Neither the name of the AutoElevate nor the names of its contributors
#      may be used to endorse or promote products derived from this software
#      without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL OPENDNS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

<#
.SYNOPSIS
  Uninstalls the AutoElevate agent and creates a log file on the root of the C: drive
  #>

$softwareDisplayName = "AutoElevate"
$serviceName = "AutoElevateAgent"
$logFilePath = "C:\AutoElevateUninstallLog.txt"    
$registryKeyPath = "HKLM:\Software\autoelevate"
$folderPath = "C:\Program Files*\AutoElevate"

$ScriptFailed = "Script Failed!"

function Get-TimeStamp {
    return "[{0:MM/dd/yy} {0:HH:mm:ss}]" -f (Get-Date)
}

function Debug-Print ($msg) {
    if ($DebugPrintEnabled -eq 1) {
        Write-Host "$(Get-TimeStamp) [DEBUG] $msg"
    }
}

function Kill-Service {
# Check if the script is running with administrator privileges
if (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
    Write-Host "Please run this script as an administrator."
    exit
}
taskkill /F /FI "SERVICES eq AutoElevateAgent"
}

function Del-Registry-Key {  
# Check if the registry key exists before attempting to delete it
if (Test-Path -Path $registryKeyPath) {
    # Prompt for confirmation (uncomment this line if you want to prompt for confirmation)
    # $confirmation = Read-Host "Are you sure you want to delete $registryKeyPath? (Y/N)"
    
    # If the user confirms (or if you skip confirmation), delete the registry key
    # if ($confirmation -eq "Y" -or $confirmation -eq "y") {
    Remove-Item -Path $registryKeyPath -Recurse -Force
    Write-Host "Registry key $registryKeyPath deleted successfully."
    # }
} else {
    Write-Host "Registry key $registryKeyPath not found."
}
}

function Del-AEFolder {  
# Check if the folder exists
if (Test-Path -Path $folderPath -PathType Container) {
    # Delete the folder and its contents
    Remove-Item -Path $folderPath -Recurse -Force
    Write-Host "Folder '$folderPath' deleted successfully."
} else {
    Write-Host "Folder '$folderPath' does not exist."
}
# Function to log messages to the log file
function Write-Host {
    param (
        [string]$message
    )
    
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $logMessage = "$timestamp - $message"
    $logMessage | Out-File -Append -FilePath $logFilePath
}
}

function UninstallAE {  
# Check if the log file exists, if not, create it
if (-not (Test-Path -Path $logFilePath)) {
    New-Item -Path $logFilePath -ItemType File
}

Write-Host "Uninstallation process started for '$softwareDisplayName'."

$uninstallKey = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq $softwareDisplayName }

if ($uninstallKey) {
    Write-Host "Uninstalling '$softwareDisplayName'..."
    $uninstallResult = $uninstallKey.Uninstall()
    
    if ($uninstallResult.ReturnValue -eq 0) {
        Write-Host "'$softwareDisplayName' was successfully uninstalled."
    } else {
        Write-Host "Failed to uninstall '$softwareDisplayName'. Return code: $($uninstallResult.ReturnValue)"
    }
} else {
    Write-Host "Software '$softwareDisplayName' not found in the list of installed programs."
}
}

function main () {
    Debug-Print("Checking for Begining uninstall...")
    
    Write-Host "$(Get-TimeStamp) SofwareName: " $softwareDisplayName
    Write-Host "$(Get-TimeStamp) ServiceName: " $serviceName
    Write-Host "$(Get-TimeStamp) RegistryName: " $registryKeyPath
    Write-Host "$(Get-TimeStamp) DirectoryName: " $folderPath
    Write-Host "$(Get-TimeStamp) RegistryName: " $registryKeyPath
    Write-Host "$(Get-TimeStamp) LogFilePath: " $logFilePath
    
    Kill-Service
    Del-Registry-Key
    Del-AEFolder
    UninstallAE
    
    Write-Host "$(Get-TimeStamp) AutoElevate Agent successfully uninstalled!"
}

try
{
    main
} catch {
    $ErrorMessage = $_.Exception.Message
    Write-Host "$(Get-TimeStamp) $ErrorMessage"
    exit 1
}

Write-Host "Uninstallation process completed. Log file: $logFilePath"

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Distribuzione RMM generica tramite comandi PowerShell
  • File di installazione di ConnectWise Automate (Labtech)
  • Datto RMM - Componente di distribuzione (script)
  • Procedura di distribuzione di contanti VSA
  • Products
    • Privileged Access Management
    • Password Management
  • Solutions
    • For MSPs
    • For IT Pros
    • By Industry
  • Resources
    • Weekly Demos
    • Events
    • Blog
    • FAQ
  • Company
    • Leadership
    • Culture + Values
    • Careers
    • Awards
    • News & Press
    • Trust Center
    • Distributors
  • Get Pricing
  • Free Trial
  • Request a Demo
  • Support
  • Login
  • Contact
4925 Independence Parkway
Suite 400
Tampa, FL 33634
CALL US (813) 578-8200
  • Link to Facebook
  • Link to Linkedin
  • Link to Twitter
  • Link to Youtube
© 2023 CYBERFOX LLC ALL RIGHTS RESERVED  |  Privacy Policy

Knowledge Base Software powered by Helpjuice

Expand