java_runtime template

Antworten
bbain
Beiträge: 16
Registriert: 07 Mär 2014, 19:56

java_runtime template

Beitrag von bbain »

Good afternoon everyone:

I had been running into problems installing java on my Windows 8 machines using the existing opsi script I had. So I looked on the user scripts and have started using the one labeled java_runtime. (The other one there seems great but like a lot of overkill for me at this point).
The one I'm using is here:
wiki/userspace:java_runtime

It installs just fine but I was actually trying to get the delsub to work -- and in there, I'm getting an error in the for loop. During the opsi install it tells me that I shouldn't use a pre-defined variable. I've tried re-copying and re-pasting but that didn't seem to help anything. I tried changing it to use a %variable% like the examples in the manual use -- then setting a variable to the value in %variable% and that also didn't appear to work. This seems like it would be a really elegant way of handling uninstalls if I can get it working (for this and other products).

Anyone else have something like this working? Am I missing something obvious?

This is what is throwing the error:
Set $result$ = getRegistryKeyList64("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
for $app$ in $result$ do Sub_searchApp64
if not ($UninstallCommandList$ = "")
set $result1$ = splitString($UninstallCommandList$,"::")
for $UninstallCommand$ in $result1$ do Winbatch_uninstall_64 /64Bit
sub_check_exitcode
endif

Thanks all!
Brent
hadro
Beiträge: 57
Registriert: 14 Mär 2013, 15:37

Re: java_runtime template

Beitrag von hadro »

try this:

Code: Alles auswählen

[DosInAnIcon]
wmic product where "name like 'Java(TM) 6%%'" call uninstall /nointeractive
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive
or brutality:

Code: Alles auswählen

[DosInAnIcon]
wmic product where "name like 'Java%'" call uninstall /nointeractive
mirkt
Beiträge: 95
Registriert: 05 Jun 2013, 09:39
Wohnort: Lithuania

Re: java_runtime template

Beitrag von mirkt »

I am using the same method for uninstall as hadro suggested, just keep in mind that on some computers it will never end (or after very long time) so I suggest adding "/WaitForProcessEnding":

Winbatch_uninstall_java7 /WaitForProcessEnding "wmic.exe" /TimeOutSeconds 600

[Winbatch_uninstall_java7]
wmic product where "name like 'Java 7%%'" call uninstall /nointeractive

You can look into your software inventory database for Java names needed..
bbain
Beiträge: 16
Registriert: 07 Mär 2014, 19:56

Re: java_runtime template

Beitrag von bbain »

Do you worry about a reboot after that's over (before installing?)?

BTW -- this is even more elegant. Thank you both for the response. I was struggling to keep my delsub updated with all the possible MSIDs and it was becoming incredibly complex/time consuming to debug.

Thanks!!
Brent
mmarten
Beiträge: 4
Registriert: 23 Okt 2014, 19:15

Re: java_runtime template

Beitrag von mmarten »

Hi,

You can also use my tool "UninstMsi". It works similar to the "wmic" method, but a little smarter.
It provides evaluable Return Codes from msiexec and has a progress bar.

This example uninstalls all Java JRE versions 6 to 8

Code: Alles auswählen

uninstmsi /product "Java%[6-8] Update%"
You can download UninstMsi (incl. opsi scripts) here:
wiki/userspace:uninstall_one_or_more_ve ... e_-product
bbain
Beiträge: 16
Registriert: 07 Mär 2014, 19:56

Re: java_runtime template

Beitrag von bbain »

Thank you!

I am testing the uninstaller out now and it is working well for my Java installation as well as a quicktime opsi package I updated.

Thanks,
Brent
mirkt
Beiträge: 95
Registriert: 05 Jun 2013, 09:39
Wohnort: Lithuania

Re: java_runtime template

Beitrag von mirkt »

Hello,

Looks like great tool, but without source code I am not sure if it's safe to use..

Good luck
mmarten hat geschrieben:Hi,

You can also use my tool "UninstMsi". It works similar to the "wmic" method, but a little smarter.
It provides evaluable Return Codes from msiexec and has a progress bar.

This example uninstalls all Java JRE versions 6 to 8

Code: Alles auswählen

uninstmsi /product "Java%[6-8] Update%"
You can download UninstMsi (incl. opsi scripts) here:
wiki/userspace:uninstall_one_or_more_ve ... e_-product
mmarten
Beiträge: 4
Registriert: 23 Okt 2014, 19:15

Re: java_runtime template

Beitrag von mmarten »

Hi,

for all those on the source code (AutoIt3) of "UnInstMsi" are interested, I have a download link provided.

http://goo.gl/HtshWu

Marcus

mirkt hat geschrieben:Hello,

Looks like great tool, but without source code I am not sure if it's safe to use..

Good luck
mmarten hat geschrieben:Hi,

You can also use my tool "UninstMsi". It works similar to the "wmic" method, but a little smarter.
It provides evaluable Return Codes from msiexec and has a progress bar.

This example uninstalls all Java JRE versions 6 to 8

Code: Alles auswählen

uninstmsi /product "Java%[6-8] Update%"
You can download UninstMsi (incl. opsi scripts) here:
wiki/userspace:uninstall_one_or_more_ve ... e_-product
mirkt
Beiträge: 95
Registriert: 05 Jun 2013, 09:39
Wohnort: Lithuania

Re: java_runtime template

Beitrag von mirkt »

Thank you, Marcus!
Benutzeravatar
SisterOfMercy
Beiträge: 1556
Registriert: 22 Jun 2012, 19:18

Re: java_runtime template

Beitrag von SisterOfMercy »

bbain hat geschrieben:I was struggling to keep my delsub updated with all the possible MSIDs and it was becoming incredibly complex/time consuming to debug.
That's why the code in the first post searches for all MSIs with the name "Java 7" in it.

Oh yeah, I should have edited the wiki a while ago.. This all costs time, which I don't have :(
Sometimes, not always, the Java installer wants a reboot, somehow. I have tried the wmic too, but if the java installer exits with exitcode 3010 it needs a reboot. If I'm correct this is the same any way you uninstall.

BTW, I never had errors in that for loop, so I can't help you much further. Please show your entire .ins files.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten