I need to removed all un-authorized java versions from a machine and keep only approved ones.
While creating an action script and its pertaining relevance I received this error (The tuple index 1 is out of range).
Relevance used as substitution:-
names of keys whose ((value “DisplayName” of it as string as lowercase contains “Java” as string as lowercase) And (value “DisplayName” of it as string as lowercase != “Java8Update24” as string as lowercase) And (value “DisplayName” of it as string as lowercase != “Java7Update62” as string as lowercase)) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if x64 of operating system then (x32 registry;x64 registry) else registry)}
Its outcome is two or more GUID values like
{0CE5061A-8179-4C62-96D3-86CCC96BA67E}
{0CE5061A-8179-4C62-96D3-86CCC96BA67E}
{0CE5061A-8179-4C62-96D3-86CCC96BA67E}
But in the below mentioned Action script I need to supply one GUID at a time to remove the un-authorized packages from the machines one by one.
Action script to be executed with above relevance substituion-
waithidden {pathname of system folder}\msiexec.exe /X {names of keys whose (value “DisplayName” of it as string contains “Java” And (value “DisplayName” of it as string as lowercase != “Java8Update24” as string as lowercase) And (value “DisplayName” of it as string as lowercase != “Java7Update62” as string as lowercase)) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if x64 of operating system then (x32 registry;x64 registry) else registry)} /qn /qnorestart
The above mentioned action script has result =
(waithidden msiexec.exe /X {0CE5061A-8179-4C62-96D3-86CCC96BA67E}{0CE5061A-8179-4C62-96D3-86CCC96BA67E}{0CE5061A-8179-4C62-96D3-86CCC96BA67E} /qn /qnorestart )
To resolve the issue I thought of using Tuple to supply only one GUID at a time, but it fails with error (The tuple index 0 is out of range OR The tuple index 1 is out of range).
Try Appendfile {concatenation "%0d%0a" of ("msiexec /x" & it & " /qn REBOOT=ReallySuppress") of names of keys whose (value "DisplayName" of it as string contains "Java" And (value "DisplayName" of it as string as lowercase != "Java8Update24" as string as lowercase) And (value "DisplayName" of it as string as lowercase != "Java7Update62" as string as lowercase)) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries;x64 registries)}
This builds a separated msiexec line for each result (the %0d%0a is the CR/LF end-of-line marker).
Or better yet, just use the tasks that already exist for doing this in the Updates for Windows Applications site.
Oh wait, you want to keep those two specific JRE versions? Those are quite old and vulnerable…
Now how to give a gap between uninstall action of running batch file.
If I do not want to run the batch file and do it from action script.
How to supply only one GUID value in the action script.
One more question :-
How can I give a timeout in between running of two msiexec uninstall actions. As the appendfile task makes a batch file with only uninstall strings and executed them as a single task.
Sample of batch file created by the action you suggested:
Another tactic might be to create individual fixlets to uninstall individual Java components, then build a Baseline with the ones you want removed. You could then create a “delay” task to run between each of your remove tasks.
There are several forum postings that discuss various ways to create a Delay in a Task. Several involve using PING commands.
If msiexec is returning before an uninstall has finished, you can probably have it block instead by using Appendfile {concatenation "start /wait %22%22 msiexec /x"} ...
That will give a batch containing Start /wait "" msiexec /x{guid}
So that each line of the batch waits for the uninstall to complete. Start /wait is not always needed, it depends on how the msi was written.
Jason could you also help me with correction of this relevance
names of keys whose (value “DisplayName” of it as string contains “Java” And (value “DisplayName” of it as string as lowercase != “Java8Update24” as string as lowercase) And (value “DisplayName” of it as string as lowercase != “Java7Update62” as string as lowercase)) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x32 registries;x64 registries))
I need to add a OR statement to check if it also contains “J2SE” OR “Java Runtime” along with “Java” in the above relevance and keep the check of excluding those 2 (Java7Update62 and Java8Update24)
I tried but have the below mentioned result
q: values “DisplayName” of keys whose ((value “DisplayName” of it as string contains “Java” OR value “DisplayName” of it as string contains “J2SE”) And (value “DisplayName” of it as string as lowercase != “Java7Update62” as string as lowercase)) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (if x64 of operating system then (x32 registry;x64 registry) else registry)
A: Java 7 Update 79
A: Java7Update62
A: J2SE Runtime Environment 5.0 Update 22
A: Java Auto Updater
A: Java 7 Update 80 (64-bit)