Having trouble packaging Oracle Java in SCCM? Can't find the MSI? Once you installed Java you still have the old version as well? Today I'll explain how I to successfully deploy Oracle Java while removing older versions and be able to keep your estate to a standardized version.
2.
Click
“All Java Downloads”
3.
Select
the “Windows Offline” version.
4.
Right
click on the program and click “Run as administrator”, enter your EA
credentials
5.
When
the Java Welcome Screen appears don’t do anything, leave this open but don’t
click “install”.
6.
Browse
to the following location. Replace with your own username.
C:\Users\%username%AppData\LocalLow\Sun\Java\
In this folder you will find a subfolder with the MSI version
you are attempting to install. Copy this folder to your desktop. You can now
click “cancel” on the open installer.
7. Copy
the the files to the source location you use for deployment and give it a relevant name.
8.
Open
up the MSI in your favourite MSI editor. In this example I'm using InstEd and click on “Transform” > New
Transform. Give the Transform file a suitable name containing the product and
version it’s intended for
9.
Make
any modifications required to the MSI transform.
In the case of Oracle Java, we simply must disable
Automatic updates via “AUTOUPDATECHECK” on the Property table. But there are
other common checks you should perform such as ProductLanguage must always be
1033 (English), AllUsers should be set to 1 (this specifies a per machine
context). Always ensure to create a new Transform file for each new version.
10.
Click
“File” and Save, press OK when prompted.
10. In the SCCM Console, browse to software distribution > Packages and right click and choose New > Package from definition.
11.
Click
next, Browse and then browse to the location of the extracted MSI, select the
MSI.
12.
The
Wizard will now show the product and version number, ensure this is correct and
then click next. It’s important to check that this information is correct as
this has the potential to replace a previous piece of software in the database.
There have been several occasions where the version number clashes with a
previous one. In this case you can contact the vendor and ask them to supply a
changed version, or you can alter the version number for yourself in Instead
(property table).
13.
Select
“Always obtain files from the source directory” and click Next.
14
Click
Next
15.
Click
Finish
16.
Expand
the new package on the left-hand pane and click on “distribution points”
17.
On
the right-hand pane click “New Distribution points” and the click next on the
wizard once it appears.
18.
Select
the the relevant distribution point and click next. Note you will want to
distribute the package to all distribution points once testing is completed. Do not copy the package
to any shares marked SMSPXEIMAGES$
19.
Click
“Close”
20.
On
the left-hand pane right-click on “Programs” and select New > Program.
21.
Enter
the Program name “Install Vendor, Product, Version”
eg: Install Oracle Java 8 Update 8.0.40.
22.
Enter
the installation string under “Command Line”
eg: msiexec /i jre1.8.0_40.msi TRANSFORMS=Oracle_Java_RT_8040_AA.mst /qn
eg: msiexec /i jre1.8.0_40.msi TRANSFORMS=Oracle_Java_RT_8040_AA.mst /qn
Click Next.
23.
Select
the platform the program can be run on. Click Next.
24.
Select
“Whether or not a user is logged on” and click next.
25. In my organisation I'll be using the program for OSD and completely silent installation. I'll choose “Suppress Program Notifications” and “Allow this program to be installed from
the install software task sequence without being advertised”.
26.
Select
“import” and choose the installer you used, this will the import the product
GUID and enable MSI source management.
Record this GUID, we will use it later. Click Next.
27.
Click
Next and on the review all details page click next again.
28.
Check
the program creation was successful (indicated by green ticks) then click
Close.
29.
We
will now create a new Program to remove this version of Java, the steps for
this are essentially the same as those for the first program. This time, we
will use the program GUID that we recorded earlier to remove the software; this will ensure that only
this unique version will be removed.
**Important** do not enable MSI source management for the removal job.
**Important** do not enable MSI source management for the removal job.
eg: the full uninstall sting is msiexec /x
{26A24AE4-039D-4CA4-87B4-2F83218025F0} /qn
30.
Right
click on collections and create a “New Collection” and fill in the name of the
collection name, click Next.
31.
Click
Next
32.
Press
“OK” when prompted with "the collection has no membership rules" we will resolve this later. Click next, then Finish.
33. The
newly created collection will then show in the left-hand pane. We will now
create a sub-collection within this collection for the pilot group. Essentially
the process is a repeat of the above steps with the collection name changed. When you have done this you will have a collection within a collection similar to below.
34. We will now generate a report of all versions of Java within the estate so we know which version we need to remove. On
the left-hand pane click “Asset Intelligence” > “Asset Intelligence
Reports”. On the reading pane beside “Look for” enter Search for installed
software”.
35.
Right
Click the report and choose “run”
36.
When
the report appears select “values” and select the SMS00001 collection (all
systems). Enter %Java% in the “Enter a part of the product name” field and then
click “Display”
37.
The
report produced will show all known Java versions in the estate, we are
interested in the “Software ID” field, these GUIDS will be used these to ensure
that all previous versions are removed from a system before installing the new
version. Keep this report open.
**Important** Programs
other than the one you are searching for may appear
38.
Open the location you stored your Java MSI and create a new text document in notepad, save as“Oracle_Java_Removal.cmd” file and reopen this up with notepad.
The .cmd should start with the following tasks to close open browsers and kill relevant processes that may stop the uninstall from being successful.
@ECHO OFF
REM Close all open web browsers
:killfirefox
taskkill /f /t /im firefox.exe
tasklist /FI "IMAGENAME eq firefox.exe" 2>NUL | find /I /N "firefox.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killfirefox
:killiexplore
taskkill /f /t /im iexplore.exe
tasklist /FI "IMAGENAME eq iexplore.exe" 2>NUL | find /I /N "iexplore.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killiexplore
:killchrome
taskkill /f /t /im chrome.exe
tasklist /FI "IMAGENAME eq chrome.exe" 2>NUL | find /I /N "chrome.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killchrome
REM Close all JAVA Background Processes
:killjusched
taskkill /f /t /im jusched.exe
tasklist /FI "IMAGENAME eq jusched.exe" 2>NUL | find /I /N "jusched.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killjusched
:killjucheck
taskkill /f /t /im jucheck.exe
tasklist /FI "IMAGENAME eq jucheck.exe" 2>NUL | find /I /N "jucheck.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killjucheck
:killjqs
taskkill /f /t /im jqs.exe
tasklist /FI "IMAGENAME eq jqs.exe" 2>NUL | find /I /N "jqs.exe">NUL
if "%ERRORLEVEL%"=="0" GOTO killjqs
msiexec.exe /qn /norestart /x {B048D821-636D-43D9-82EC-8B0010734231}
msiexec.exe /qn /norestart /x {726880D7-98DE-41CC-B553-E6084260CFB7}
msiexec.exe /qn /norestart /x {0C933B8C-1154-4EC8-8832-55CEAACA3B13}
msiexec.exe /qn /norestart /x {3076929A-FB47-4CB7-A8FF-72CB95C22F95}
End the script with
exit /B %EXIT_CODE%
Ensure to save the script.
**IMPORTANT** you should
also INCLUDE the GUID of the latest version you are deploying. This will ensure
that any installations of that version on the estate are the managed version
you have distributed from SCCM.
40.
In
the SCCM Console browse to “Operating System Deployment” > Task Sequences
>Create a new "basic task sequence called "Install Oracle Java Versionname".
41.
Right
Click on the newly duplicated task sequence and click “properties”
42.
In
the “Name” field, update it to the include the include the product and latest version you are deploying. Press “Apply” when finished.
43.
Back
to the main console window, right click on the newly renamed task sequence and
choose “edit”
44.
Create a new group at the top level with the version being deployed. inside this add a "remove all oracle java" step as a "run command line". Ensure to set the package to the Java package you created earlier. I've also set the "continue on error" option for this in case there is an unknown exit code returned.
45. Add a "delay step as step 2" this is just a "run command line" step with the command set to ping a loopback address for approx 20 seconds.
46. Lastly add a "install program" step and add the program we created earlier, ensure the "install" program is selected.
47.
Right
click on the newly created Task Sequence and then click “advertise”.
48.
Click
“Browse” beside collection: and then select the “Pilot” collection you created
earlier. Click OK.
49.
Click
Next
50.
Click
the “Sun” button beside “Mandatory assignments” and select “Immediately after
this event” and “As soon as possible” from the drop-down menu, click OK.
51. Select “High”
priority, and “Always rerun program” and click next.
52.
Select “download all contents locally before
starting task sequence”, “when no local distribution point is available, use a
remote distribution point” and “when no protected distribution point is
available, use an unprotected distribution point”. Click Next.
53.
Click
next three times and finally click close.
The pilot application
is now ready for deployment testing. You can now add clients directly into the
pilot collection, any previous versions of Java will be removed before
installing the new version.
When you are satisfied that your deployment works and removes all previous versions you should the create a new collection for rollout set it to refresh every day, use a query based collection to search for all systems with Java installed not at the same version you want to deploy (example below)
Exclusions for systems can also be added as below.
When this collection becomes empty, the deployment will have been successful to the estate.
You can keep track of the systems you've upgraded by using another collection with query containing the version you are deploying. (as below)
When you run the job all versions will be replaced with this new version. You can keep your estate at this version by adding any newly released versions GUIDS to the removal script, or upgrade to a newer version by simply replacing the package with the new version.
I appreciate this is a long post, if you've stuck with me this far, thanks for that. As always feedback is appreciated by way of the comments section, also feel free to give me a +1 to help the search ranking of this page. Many thanks.
No comments:
Post a Comment