TEMPLATE - PDQ Uninstall It All

 

This is a TEMPLATE package that REQUIRES YOU to make additional MODIFICATIONS to complete the package. To be able to use this template, you will need to supply the appropriate parameters to the package. This guide was created to help walkthrough this process

  1. First, you will need to 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.
  2. Now that it is downloaded, you can double-click the package to view its contents.
  3. As you notice, the parameters field is set to "-AuditOnly" by default. This field is where you will adjust what the deployment/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 grab 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.

 

Uninstall via Name

Once you know the exact name of the program you are looking 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 1 set of 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.

 

Uninstall via List

You can also use a CSV or TXT file with application names for this.

If using a CSV, The names will need to be an an "Application Name" column for the script to be able to find them. For TXT files, you will just need to supply 1 application name per line. The script will then pull all entries in that column and use them as the Uninstall List. This can be very helpful if you have many versions of the same software, or a list of software that never needs to be installed. For this, you would use the parameter "-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. This will copy that file with the deployment so it can use that file.

With this method, you could also use PDQ Inventory to generate the CSV files 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:

  1. In PDQ Inventory, go to Reports > New Report > Basic Report.
  2. Use the Following Columns/Filters for your report:
    • Columns: Application > Name > Application Name
    • Filters > All > Application > Name > Contains > (app name)
  3. Now click Run Report > Save Data to File. This allows you to save it as a CSV.
  4. 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, it will just need to be duplicated first. This will allow you to edit the parameter freely. To easily create a template that you can edit, follow these few steps:

  1. First, you will want to go to "Packages" and find "PDQ Uninstall It All". Click on the package.
  2. Next you will want to select the version (the highest version available). 
  3. From there, 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 parameter.
This package should now work exactly the same as it does in PDQ Deploy!

 

Additional Information

  • This script will search for the following applications types: Machine-Wide installs, User-Based installs, Microsoft Apps, and Provisioned Microsoft Apps. If you come across any others that you feel like should be added, please let us know in PDQ Support: Support Ticket Form 
  • The package also comes with 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.
  • Due to the potentially dangerous nature of this template, you will need to specify the EXACT program name to uninstall. While you can use a wildcard (*) for most things, if you would like to use a more vague search, feel free to check out this article you could use as a base to create your own: Uninstalling software based on the program name
  • When given multiple programs to attempt to uninstall, the script will attempt all of them before reporting any errors. For example, if you supply 4 programs, and it fails on the 2nd program, it will still work through programs 3 and 4 before reporting the failure for program #2. However, because of this, if multiple different error occur, only one may be reported. You will have to check the output logs for more information on all failures.
  • Keep in mind, not all Programs uninstall easily. This script will give a best attempt at any software found, but may not be able to uninstall every program. Ultimately, this all depends on the information saved on the computer by the Application developers. Most applications will include uninstall string, and most of those can be ran silently, however, this is not a 1 stop script for every program. With that said, if an uninstall is not successful, the output logs will at least include what was attempted as a starting point.

 

Common Errors

  • Exit Code 1605 - This action is only valid for products that are currently installed
    • One of the listed Programs was not found on the target to uninstall. If all are successful or 1605, the deployment should be classified as a success.
    • However, this could also be due to a mistyped Application Name in the parameters field. When receiving this exit code, the output logs will display all found apps. If you get an exit code 1605 and the application does exist, check those logs to what you may need to adjust your parameters to.
  • Error Code 1628 - An invalid or unknown table was specified.
    • This means that the supplied CSV file did not have any columns named "Application Name". This column is a requirement to be able to use the CSV function for this Uninstall Script. To fix this, you need to audit your CSV file so that it contains an 'Application Name' column.
  • 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 found some commands to uninstall, sent the commands, but for some reason it did not uninstall. This often indicates that the Uninstall String left by the application was not silent. The logs should tell you the uninstall string that was used. You could try running that string on the target to see if there are any popups/prompts. You can also use this article for more ways to find silent parameters/uninstall string: 5 ways to find silent install parameters | PDQ Blog
    • Once you have the full silent uninstall string, you can create a custom deployment package with that string to uninstall: Creating Custom Packages
  • Cannot process argument transformation on parameter 'Uninstall'. Cannot convert value to type System.String.
    • The parameter supplied was likely not put in quotations correctly. If you are specifying multiple applications to uninstall, you may have wrapped each individual app name in quotations. This makes the script think there are multiple parameters, and gives this error. You need to list each app, and only wrap the entire thing in quotations (i.e. "Audacity 3.4.2, Dropbox").
  • The string is missing the terminator: ".
    • Something is wrong with the parameter you set. The script couldn't tell when the parameters were supposed to end. Likely, this is due to a missing starting or ending quotation mark.
  • A positional parameter cannot be found that accepts argument "APPNAME". -OR- Parameter set cannot be resolved using the specified named parameters.
    • Something is wrong with the parameters you set. Likely, you tried to specify both a program to uninstall (either by name or list), and the "-AuditOnly" parameter. It is not possible to combine the AuditOnly and Uninstall methods. You'll need to either remove the program parameter to run the Audit, or remove the "-AuditOnly" parameter to uninstall the program.

 

Other Issues or Feedback?

Was this article helpful?
Still have a question or want to share what you have learned? Visit our Community Discord to get help and collaborate with others.