I am responsible for the Java upgrade deployment in my organization and we used to remove prior versions until Oracle decided not to in Java 8 update 20.


Using AdminStudio, I added a custom action VBScript to run and remove all prior versions which by itself works fine.

strComputer="."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")


Set colSoftware = objWMIService.ExecQuery _
    ("Select * from Win32_Product Where Name LIKE 'Java 8%%' AND NOT name like '%%(64-bit)'")
   
    For Each objSoftware in colSoftware
    objSoftware.Uninstall()
Next


However, if I use any other switches to call the MSI such as /qb the script doesn't run.

Is there a way to force the custom action to run no matter how the MSI is "called?"

Thanks!

Answer Summary:
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answer Chosen by the Author

0

I had to recently remove all versions of Java prior to 8u51 and install it.
I found that if you use WMIC it seems to work perfectly fine with Java products for uninstalling.


This may work for you, it did for me.Here's what I did with mine, this is a copy of the job items (you might want to copy all of this into notepad and then replace the single and double quotes before pasting some of the commands into KACE):

  1. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java 2 Runtime%%' call uninstall /nointeractive.
  2. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'J2SE Runtime%%' call uninstall /nointeractive.
  3. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'J2SE Develop%%' call uninstall /nointeractive.
  4. Log Java 2 Uninstall completed to status.
  5. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java SE Development%%' call uninstall /nointeractive.
  6. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java(TM) SE Runtime%%' call uninstall /nointeractive.
  7. Log Java SE Development Uninstall completed to status.
  8. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java Web Start%%' call uninstall /nointeractive.
  9. Log Java Web Start Uninstall completed to status.
  10. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java Auto Updater%%' call uninstall /nointeractive.
  11. Log Java Auto Updater Uninstall completed to status.
  12. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java 6 Update%%' call uninstall /nointeractive.
  13. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java(TM) 6 Update%%' call uninstall /nointeractive.
  14. Log Java 6 Uninstall completed to status.
  15. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java 7 Update%%' call uninstall /nointeractive.
  16. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java(TM) 7 Update%%' call uninstall /nointeractive.
  17. Log Java 7 Uninstall Completed to status.
  18. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java 8 Update%%' call uninstall /nointeractive.
  19. Launch c:\Windows\System32\cmd.exe with params /c WMIC product where Name LIKE 'Java(TM) 8 Update%%' call uninstall /nointeractive.
  20. Log Java 8 Uninstall Completed to status.
  21. Launch c:\windows\system32\msiexec.exe with params /i $(KACE_DEPENDENCY_DIR)\jre1.8.0_51.msi /qn /NORESTART JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No.
  22. Log Java 8 Update MSI Install completed to status.
  23. Run the batch file JavaSettings.cmd with params .
  24. Log Java Settings Import completed to status.

Answered 08/22/2016 by: dkiiskila
White Belt

Please log in to comment

Answers

0
It sounds like you have the script in the InstallUISequence and not the InstallExecuteSequence.
Answered 08/22/2016 by: VBScab
Red Belt

Please log in to comment
0

That is what I thought as well, so I went back and added it but it didn't make a difference.

If I call the MSI without any switches, it removes the prior versions.

Answered 08/22/2016 by: gestenta
Senior White Belt

Please log in to comment
0

I assume that you logged your latest attempt and saw that the CA ran?

Answered 08/22/2016 by: VBScab
Red Belt

Please log in to comment
0

Right. Launched the MSI by .double clicking it and it removed Java 8 Update 91 and then installed Java 8 update 101.

Also retested the MSI by running msiexec.exe /I <MSI> and it too removed prior versions.

Answered 08/22/2016 by: gestenta
Senior White Belt

Please log in to comment
0

There are definitely a number of ways to do it with scripts etc.

For example, we have a  batch file hang around that looks similar to your script above, but I want it to be done with the MSI as it used to be.

I have AdminStudio, just can't make it work.

Answered 08/22/2016 by: gestenta
Senior White Belt

Please log in to comment
0
>Also retested the MSI by running msiexec.exe /I <MSI> and it too removed prior versions
Soooooooooooooooo...you're directly editing the MSI and not using a transform?!?
Answered 08/23/2016 by: VBScab
Red Belt

Please log in to comment
0
Yes. Not sure an MST would work in this case. Java installs didn't have MST's before and removed prior versions.
Answered 08/23/2016 by: gestenta
Senior White Belt

Please log in to comment
0

You have a fundamental misunderstanding of what an MST is for.

In the inimitable Duncan Bannatyne's words "Ahm oot."

Answered 08/23/2016 by: VBScab
Red Belt

Please log in to comment
0
Great. Thanks for your help.
Answered 08/23/2016 by: gestenta
Senior White Belt

Please log in to comment
Answer this question or Comment on this question for clarity