TEMPLATE - PDQ Uninstall It All
This is a template, not a ready-to-run package. You must edit its parameters before deploying it; the default parameter only audits and does not uninstall anything.
To use this template, do the following:
- Download the "PDQ Uninstall It All" package from the Package Library.
- If using this template in PDQ Connect, please review the "Special Steps for PDQ Connect" section before proceeding. PDQ Connect has a few extra steps needed first to be able to use this Package Template.
- Double-click the package to open it.
- The parameters field is set to "-AuditOnly" by default. This is where you will adjust what the script does. There are a few different ways you can adjust this uninstall package, depending on your needs.
Audit Mode
If you use the default parameter of "-AuditOnly", the package will not attempt to uninstall any programs. Instead, PDQ Deploy will gather a list of the target's currently installed programs and save them to the output file. When uninstalling with this tool, you will need to specify the EXACT name of the program as it appears on this list.
Individual software vendors may name their programs in unexpected ways. Some of them may include version numbers as a part of the app name, etc, so Audit Mode is helpful for identifying EXACTLY how the programs are named on the target, allowing you to use your uninstaller to uninstall exactly what you need, and nothing else.
Run your package in Audit Mode first, even if you already know the program name. Vendors sometimes append version numbers or other text to the display name, and Audit Mode confirms the exact string this script needs.
Uninstall via Name
Once you know the exact name of the program you want to uninstall, you can tell the script to attempt to uninstall that program.
Open the package, open the Step 1 - Uninstall package step, and delete -AuditOnly from the Parameters field.
Then enter the full application name, wrapped in quotation marks.
(e.g. Audacity installs with the version number added to the name, so it would be "Audacity 3.4.2")
You can also specify multiple applications (or versions of the same app) by name. You can do this by separating each app name by a comma, and wrapping all of them in one set of double quotations.
(e.g. you could specify both Audacity and Dropbox with "Audacity 3.4.2, Dropbox")
Alternately, Wildcards can be used to generalize the uninstall search. For example, specifying "Audacity *" would uninstall all applications which begin with Audacity.
A wildcard match uninstalls every application whose name matches, on every target the package runs against. Test on a small group first and double-check the match before running this at scale, since an over-broad wildcard can remove software you didn't intend to touch.
Uninstall via List
You can also use a CSV or TXT file with application names for this.
When using a file as the source for applications to uninstall, the format depends on the file type:
- CSV files must contain a column named "Application Name". The script reads every entry in this column and uses them as the uninstall list.
- TXT files should contain one application name per line. Each line is treated as a separate application to uninstall.
Using a file can be especially helpful when managing multiple versions of the same software or maintaining a list of applications that should never be installed.
To use a file as the source, specify the -FilePath parameter and provide the UNC path to the file. For example, -Filepath <UNC_path_to_file>.
You could also add the CSV/TXT file to the "Additional Files" field in PDQ Deploy, and call it just by name in the parameters field. Be sure to add this to the current Uninstall_It_All_Exceptions.csv file already liksted. This will copy that file with the deployment so it can use that file.
With this method, you can also use PDQ Inventory to generate the CSV file of the application names you need to uninstall. For example, if you wanted to get rid of every version of Audacity in your environment, you could do the following in PDQ Inventory to generate the perfect CSV file for this:
- In PDQ Inventory, go to Reports > New Report > Basic Report.
- Use the Following Columns/Filters for your report:
- Columns: Application > Name > Application Name
- Filters > All > Application > Name > Contains > (app name)
- Now click Run Report > Save Data to File. This allows you to save it as a CSV.
- You can now use this CSV with the deployment to uninstall them all!
Special Steps for PDQ Connect
To use this Template in PDQ Connect, you must duplicate it first. This will allow you to edit the parameters freely. To easily create a template that you can edit, follow these few steps:
- Go to "Packages" and search for "PDQ Uninstall It All".
- Click on the package.
- Select the latest version available.
- Click the ⋮ kebab menu in the top right corner, and select "Duplicate Package"
This creates a copy of that package in your "Packages" view that allows you to edit the parameters.
This package should now work exactly the same as it does in PDQ Deploy!
Additional Information
Supported application types
This script searches for the following application types: Machine-Wide installs, User-Based installs, Microsoft Apps, and Provisioned Microsoft Apps. If you come across any others that you feel should be added, please let us know. Use this link to open a support ticket with us: Support Ticket Form
Exceptions list
The package includes a Uninstall_It_All_Exceptions.csv file in the "Additional Files" field. This is a list of apps that don't like to play by the rules. They are not happy with uninstalling the 'normal way', so we gave extra instructions on how to uninstall those. You can update this list to the latest version anytime by redownloading this template from the Package Library.
Wildcard usage and risk
Due to the potentially dangerous nature of this template, you must be careful when specifying program name to uninstall. Make sure to test thoroughly before you deploy in production.
Multiple-program error handling
When multiple programs are provided, the script attempts to uninstall each one before reporting any errors. For example, if four programs are specified and the second uninstall fails, the script will still process the third and fourth programs before reporting the failure. As a result, if multiple errors occur, only one may be reported. Review the output logs for details on any additional failures.
Uninstall success is not guaranteed
Not all programs uninstall cleanly. This script makes a best effort to remove any detected software, but it cannot guarantee success for every application. Uninstall behavior depends on the information provided by the application's developer. Most programs include an uninstall string, and many support silent uninstalls, but this is not a universal solution for every piece of software.
If an uninstall attempt fails, review the output logs. They include the commands and methods that were attempted, providing a useful starting point for further troubleshooting.
Common Errors
-
Exit Code 1605 - This action is only valid for products that are currently installed
- One or more of the specified programs was not found on the target device. If all uninstall attempts either succeed or return 1605 (application not found), the deployment should still be considered successful.
This exit code may also indicate that an application name was entered incorrectly in the parameters. When a 1605 is returned, the output logs include a list of all detected applications. If the application is installed but you still receive a 1605, review the logs to determine how the application is being reported and adjust your parameters accordingly.
- One or more of the specified programs was not found on the target device. If all uninstall attempts either succeed or return 1605 (application not found), the deployment should still be considered successful.
-
Error Code 1628 - An invalid or unknown table was specified.
- The supplied CSV file does not contain a column named "Application Name". This column is required for the CSV import feature used by this script.
To resolve this issue, review your CSV file and ensure it includes a column named "Application Name". Once the column has been added and populated with the appropriate values, rerun the deployment.
- The supplied CSV file does not contain a column named "Application Name". This column is required for the CSV import feature used by this script.
-
Error Code 1
- This is PowerShell speak for "Something went wrong". Check the output log for more information.
-
Cannot process command because of one or more missing mandatory parameters
- Something is wrong with the parameters you've set. Make sure it is not blank, your commas are in the correct places, etc...
-
<APPNAME> was not successfully uninstalled. The uninstall command was sent, but the app is still installed. Manual Intervention may be required.
- The uninstaller located one or more uninstall commands and attempted to run them, but the application was not removed. This typically occurs when the application's uninstall command does not support silent execution or requires user interaction.
The output logs include the uninstall command that was used. As a troubleshooting step, try running that command manually on a target device to see if it generates prompts, dialog boxes, or other interactive requirements that would prevent a silent uninstall. See 5 ways to find silent install parameters | PDQ Blog for more information on silent parameters. - Once you have the full silent uninstall string, you can create a custom deployment package with that string to uninstall the app. See Creating Custom Packages for more information.
- The uninstaller located one or more uninstall commands and attempted to run them, but the application was not removed. This typically occurs when the application's uninstall command does not support silent execution or requires user interaction.
-
Cannot process argument transformation on parameter 'Uninstall'. Cannot convert value to type System.String.
- The parameter was likely not quoted correctly. When specifying multiple applications to uninstall, do not place quotation marks around each application name. Doing so causes the script to interpret them as separate parameters, which results in this error.
Instead, provide the list as a single quoted parameter, with application names separated by commas. For example, "Audacity 3.4.2, Dropbox".
- The parameter was likely not quoted correctly. When specifying multiple applications to uninstall, do not place quotation marks around each application name. Doing so causes the script to interpret them as separate parameters, which results in this error.
-
The string is missing the terminator: ".
- There is an issue with the parameter provided. The script was unable to determine where the parameter value ended, which usually indicates a formatting error. This is most commonly caused by a missing opening or closing quotation mark.
Review the parameter and ensure that all quotation marks are properly paired and placed. If you are specifying multiple values, verify that the entire parameter is enclosed correctly and that no quotation marks are missing or misplaced.
- There is an issue with the parameter provided. The script was unable to determine where the parameter value ended, which usually indicates a formatting error. This is most commonly caused by a missing opening or closing quotation mark.
-
A positional parameter cannot be found that accepts argument "APPNAME". -OR- Parameter set cannot be resolved using the specified named parameters.
- The parameters provided are conflicting. This error typically occurs when both an application to uninstall (by name or list) and the "-AuditOnly" parameter are specified in the same command.
The Audit and Uninstall modes cannot be used together. To resolve this issue:- Remove the application parameter if you want to perform an audit only.
- Remove the "-AuditOnly" parameter if you want to uninstall one or more applications.
- The parameters provided are conflicting. This error typically occurs when both an application to uninstall (by name or list) and the "-AuditOnly" parameter are specified in the same command.
Other Issues or Feedback?
- Let us know about them via this form: Support Ticket Form
In the Support Request, be sure to include the following:- Any Output Logs: How to view the Output Logs | PDQ Deploy
- The full error: How to view the full Error Stack | PDQ
- The package definition: Right-click on your package and select Export.
Send us the resulting XML file so we can have a look at your package configuration.