- 14 Mar 2024
- 2 読む分
- 印刷する
- PDF
Uninstall exe applications from Windows devices.
- 更新日 14 Mar 2024
- 2 読む分
- 印刷する
- PDF
The following PowerShell script helps the IT Admins to uninstall Exe application(s) from their managed Windows devices.
Create a file on your desktop, for example, uninstall_exe.ps1 and open it in a text editor like notepad++
Copy the contents below to the file or click here to download the file.
# Define the path to the application executable $applicationPath = "C:\Path\To\Application.exe" # Define the path to the uninstaller $uninstallerPath = "C:\Path\To\Uninstaller.exe" # Define any additional uninstallation arguments if needed $uninstallArguments = "/S" # Silent uninstallation argument # Check if the application is installed if (Test-Path $applicationPath) { # Uninstall the application Start-Process -FilePath $uninstallerPath -ArgumentList $uninstallArguments -Wait Write-Output "Application has been uninstalled successfully." } else { Write-Output "Application is not installed on this system." }
In the Script,
Replace $applicationPath with the path to the application's executable file.
Replace $uninstallerPath with the path to the application's uninstaller executable file (if available). If the application doesn't have a separate uninstaller, you may need to find an alternative method to uninstall it.
Modify $uninstallArguments as needed to pass any additional arguments required for silent uninstallation.
Ensure that the paths and arguments provided in the script match the installation and uninstallation process of the specific application you want to uninstall.
Follow our guide to upload & publish the PowerShell script using Scalefusion Dashboard.
Once the script is successfully executed, you will be able to see the status of the same in the View Status report on the Scalefusion dashboard.
For example, the following script helps to uninstall WinRar application.
# This is a script tested for just the WinRar application. Define the path to the WinRAR executable.
$winrarPath = "C:\Program Files\WinRAR\WinRAR.exe"
# Check if WinRAR is installed
if (Test-Path $winrarPath) {
# Uninstall WinRAR
Start-Process -FilePath "C:\Program Files\WinRAR\Uninstall.exe" -ArgumentList "/S" -Wait
Write-Output "WinRAR has been uninstalled successfully."
} else {
Write-Output "WinRAR is not installed on this system."
}
Please note that to use the PowerShell scripts, the Scalefusion MDM Agent Application must be installed on the device(s). Please follow our guide to publish and install the Scalefusion MDM Agent Application.
Notes:
The scripts and their contents are sourced from various albeit authenticated Microsoft sources and forums.
Please validate the scripts on a test machine before deploying them on all your managed devices.
Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.