My mistake, actually, I thought the cmd shell would interpret %JAVA% as an empty shell variable, but apparently it does not, assuming %JAVA% is not set as a variable
C:\Temp>echo %JAVA%
%JAVA%
C:\Temp>echo %PROGRAMFILES%
C:\Program Files
Testing on my system, the following actionscript is working as expected to remove Oracle JDK 21:
action uses wow64 redirection {not x64 of operating system}
waithidden cmd /C wmic product where "name like '%JAVA%'" call uninstall
@S2S, if yours is not working, try posting the snippet of the BES Client Log from this action. I’d also suggest building this as a batch file so you can capture any error messages from the shell.
delete __appendfile
appendfile wmic product where "name like '%%JAVA%%'" call uninstall
delete uninstall.cmd
move __appendfile uninstall.cmd
action uses wow64 redirection {not x64 of operating system}
waithidden cmd.exe /c uninstall.cmd > c:\windows\temp\output.log 2>&1
I’ve also tested that this works to remove Oracle JDK 21, no dialogs are presented to the user, and it generates the c:\windows\temp\output.log file with this content:
C:\BES\Client\__BESData\actionsite>wmic product where "name like '%JAVA%'" call uninstall
Executing (\\WIN11\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{8D4CF14F-F1A6-576C-AE82-5F90CC628632}",Name="Java(TM) SE Development Kit 21 (64-bit)",Version="21.0.0.0")->Uninstall()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = 0;
};