Trouble Uninstalling an App using the "Uninstall Specific App by Name" worklet from the Worklet Catalog
As much of a mouthful the name can be, there is really a simple answer to this. However, is the app unable to be uninstalled using this worklet? Then read on.
Symptoms
A specific app is unable to be uninstalled using this worklet. Either a COMMAND TIMED OUT message is issued in the Activity Log, or the Evaluation Code is unable to register the App as existing, or the Remediation Code is simply not removing the app.
Steps to resolution
There are a couple of troubleshooting steps we can take before we do this.
- First, we need to check and see if the application is the same name in the worklet, as it would appear in "Apps and Features". If it is indeed the correct name, then we can take the next step.
- Second, we can take the Remediation Code from the Worklet and run it locally. Keep in mind that the worklet runs from an NT AUTHORITY/SYSTEM user, so some registry paths may need to be changed.
- For example, instead of it saying "sysnative", it may need to include "syswow64" instead.
- Here's an edited version of the Evaluation and Remediation Codes to see what that would look like:
Evaluation Code:
$scriptBlock = { $appName = '' $uninstReg = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall') $installed = @(Get-ChildItem $uninstReg -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object {($_.DisplayName -like $appName)}) if ($installed) { return 1 } else { return 0 } } $exitCode = & "$env:SystemRoot\syswow64\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock Exit $exitCode
Remediation Code:
$scriptBlock = { $appName = '' $exeCmd = '/S' $uninstReg = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Veritas NetBackup Client','HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall') $installed = @(Get-ChildItem $uninstReg -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object {($_.DisplayName -like $appName)}) $uninstalled = @() foreach ($version in $installed) { $uninstString = $version.UninstallString if($uninstString -match 'msiexec') { $process = Start-Process msiexec.exe -ArgumentList "/x $($version.PSChildName) /qn /norestart" -Wait -PassThru } else { $process = Start-Process $uninstString -ArgumentList $exeCmd -Wait -PassThru } if (($process.ExitCode -eq '0') -or ($process.ExitCode -eq '1641') -or ($process.ExitCode -eq '3010')) { $uninstalled += $version.PSPath } } return $uninstalled } $uninstalledApps = & "$env:SystemRoot\syswow64\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptBlock Write-Output "Uninstalled the following key: $uninstalledApps" if($uninstalledApps) { Write-Output "Uninstall Successful" Exit 0 } else { Write-Output "Uninstall Failed" Exit 1 }
- Now, if this code does not work, then we need to move to the next step.
- Open your RegEdit and search for the application you would like to uninstall. Does the Registry Path match the Registry Path in the worklet? In this example, we'll use Veritas NetBackup Client:
- If the answer to that is "yes", then we move on to the final step.
- If the registry matches, the name matches, and so on, then unfortunately this option will not work for your application. In the example of Veritas NetBackup Client, it requires special uninstall instructions that cannot be removed by normal conventions. The explanation for that can be found on its Support Site.
Other Notes:
- You can find out if something is uninstallable through the "is_uninstallable" field by using the "GetDevicePackages" call from our API portal. Instructions can be found here: https://developer.automox.com/openapi/axconsole/operation/getDevicePackages/
- There is also the option to roll back patches using the Roll Back action button on the Device Details page: How to Roll Back an Installed Patch on Devices.
Comments
0 comments
Please sign in to leave a comment.