Application uninstall worklet

Is it necessary to have an “evaluation” on the worklet? I just want to use the remediation portion to push a Powershell script to uninstall an application. Something like this.

$application1 = Get-WmiObject -Class Win32_Product -Filter “Name = ‘RingCentral Phone’”

Yes, the evaluation code is needed… but you can use it in different ways.

  1. You can set a fully functional evaluation code. Example, check a registry key, look for a file, or check another system attribute. This is the most feature rich option as it provides an accurate compliance response in the console, and would only run remediation when scheduled if needed.
  2. Set the evaluation code to “Exit 0”. A zero return provides a compliant response. This is a good way to set a Worklet you will only run manually, and don’t want it to return a non-compliant state in the console.
    3). Set the evaluation code to return a non-zero response. Ex. “Exit -1”. This will always show your worklet is non-compliant, but allows you to run manually without a schedule, or always run your remediation code on a schedule.
1 Like

You can force non compliance to execute remediation as mentioned.

But the ask is, why are u running it more then you need to?

If I was tasked to uninstall software abc by company management. Sending the powershell script regardless will uninstall… but there would be lesser visibility.
I’ll only end up see all remediate and funky errors if there was nothing but a 1-liner.

I would set a evaluation to check and fail if found (uninstall reg entry or file presence check for sneaky fellas). Then report how many actually uninstalled. At least it looks better for me the sysadmin

Using a forced non-compliant code is definitely only for a specialized use case. A few examples would be running a task like disk cleanup, updating a system certificate, collecting log information, or restarting a service. You may want this type of process to run regardless of system state.
I fully agree with your assessment though. Running a software install/uninstall would be best handled with a proper evaluation code block or on-demand rather than by a forced remediation on a schedule regardless of state.

1 Like

Or using a Required Software Policy, which allows you to specify the software name and version and the policy will check the Add/Remove programs database before it attempts to install the software.

1 Like