This article explains how to identify and uninstall an application that was not installed by Factorial IT or FleetDM, using OSQuery and scripts in FleetDM.
Identify the application across the fleet
- Go to your FleetDM instance
- Create a new OSQuery query to detect the application on your devices
- For Windows:
For macOS:SELECT * FROM programs WHERE name LIKE '%ApplicationName%'SELECT * FROM apps WHERE name LIKE '%ApplicationName%';
- For Windows:
- Run the query across your fleet to identify affected devices
Uninstall the application on Windows
- In the OSQuery results, locate the uninstall_string column
- Copy the command provided in this column
- Create a PowerShell script containing this command, for example
(Replace the command with the one shown in the uninstall_string column.)Start-Process -FilePath "msiexec.exe" -ArgumentList "/x {ProductCode} /quiet" -Wait - Import the script into FleetDM
- Run the script on the identified devices to uninstall the application
Uninstall the application on macOS
- Create an uninstall script that removes the app using the
rmcommand
Exemple:sudo rm -rf /Applications/ApplicationName.app - Import the script into FleetDM
- Run the script on the affected devices
Verify removal
Run the OSQuery again to confirm that the application has been successfully removed.