Why AgentP cannot uninstall some applications automatically and how to run custom uninstall scripts
In this topic, you will learn why Portnox Cloud remediation policies using AgentP cannot uninstall some applications automatically, and how to work around this by creating a periodic script that detects the unwanted application and uninstalls it.
Some Windows applications cannot be uninstalled automatically by AgentP or other management tools. This is not a limitation of AgentP – it affects all Windows management software, including Intune, SCCM, and similar products.
The reason is that some apps install per user, using custom EXE installers or updaters, and do not register with Windows in the standard system-wide way. For these apps, there is no MSI product code, no silent uninstall command, and any registry entries are limited to the user’s profile. Removing the application files (and optionally the user-specific registry keys) is effectively what an uninstall does, and it is safe – leftover registry entries do not affect the system or other users.
To remove these apps automatically, you can use Portnox Cloud’s remediation policy with a Periodic Script. This lets you create a script that checks for the unwanted software and removes it silently, and then schedule it to run at regular intervals. Using this approach, AgentP can enforce removal for software that cannot be uninstalled automatically through standard Windows methods.
Here is a very simple example of a PowerShell script for Discord:
$discordPath = "$Env:LOCALAPPDATA\Discord"
$discordReg = "HKCU:\Software\Discord"
Stop-Process -Name Discord -Force -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force $discordPath -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force $discordReg -ErrorAction SilentlyContinue
Common examples of software that often cannot be uninstalled automatically include Discord, Spotify (user install), Zoom (per-user), Slack, Microsoft Teams (classic user install), Google Chrome or Firefox (user installs), Steam, Epic Games Launcher, and applications like Notion, Figma, GitHub Desktop, or Postman. These apps are usually installed manually by users and require a custom script to be fully uninstalled.
