SCCM Java Inventory and Metering

Benoit LecoursSCCM18 Comments

After January 2019, businesses will need a commercial license to receive updates for Oracle Java SE products. This means that if you’re using Java in your environment, chances are that your management will need to know how many licenses to buy and how many PC has Java installed but don’t use it.

SCCM Java Inventory

The bad news is that SCCM Software Metering cannot do a reliable job to track Java Usage since the executable file always runs on computers. The good news is that there’s a way to track Java usage using Oracle tools… but it’s not straightforward.

After searching, I found an awesome script made by Steve Jesok that do exactly what I needed. Unfortunately, the blog post is a bit old and don’t have detailed information on how to implement it.

We will guide you through the process and we’ll also provide a free report to help you track your java usage using SCCM.

Important Info
Java Usage Tracker requires a commercial license for use in production. To learn more about commercial features and how to enable them, see Oracle Java SE Advanced & Suite Products.

Process Overview

Here’s a high-level process overview. It’s quite simple as the PowerShell script, configuration item and report are already created. You only have to import everything on your SCCM server.

  • Download Java inventory .zip file
  • Import Configuration Data in SCCM
  • Modify Configuration Baseline
  • Deploy Configuration Baseline
  • Import Report

Download SCCM Java Inventory .zip file

I cannot say this enough, all the magic behind this solution is possible because of Steve Jesok script. Download the .zip file from the MNSCUG website or from our direct link (backup link…) and save it on your computer.

Import Java Configuration Data

Once you have downloaded the .zip file, extract it so you have a .cab file. We will use the .cab file to create a Configuration Item in SCCM.

  • In the SCCM Console, go to Assets and Compliance / Compliance Settings / Configuration Items
  • Right-click Configuration Items and select Import Configuration Data

SCCM Java Inventory

  • Click Add

SCCM Java Inventory

  • Select the JavaUsageTracking.cab file

SCCM Java Inventory

  • Click Next

SCCM Java Inventory

  • Click Next

SCCM Java Inventory

  • Validate and close the wizard

SCCM Java Inventory

  • The Java Logging Configuration Item has been created

SCCM Java Inventory

  • Right-click the Java Logging Configuration Item and select Properties
  • By default the Configuration Item cannot run on Windows 10, select the Supported Platforms and enable Windows 10. Select Other Operating System that you want to support.

SCCM Java Inventory

  • You should also have a Java Usage Tracking Configuration Baseline created by the import process

SCCM Java Inventory

  • Right-click the baseline and select Deploy

SCCM Java Inventory

  • Click Browse and select a test collection

SCCM Java Inventory

Java Configuration Baseline – Test and verification

We will now evaluate the Java Configuration Baseline on our test computer.

  • Log on your test computer
  • Open Control Panel / Configuration Manager applet
  • In the Configurations tab, select the Java Usage Tracking baseline and select Evaluate

SCCM Java Inventory

  • Once Evaluate, click View Report
  • The report will show Non-Compliant but this is normal

SCCM Java Inventory

  • Validate the presence of the usagetracker.properties file that has been created by the baseline. The file should be in the C:\Program Files (x86)\Java\Jre[yourversion]\lib\management folder

SCCM Java Inventory

  • The script also logs its action in the SCCM log directory – CM_JavaUsageLogging.log

SCCM Java Inventory

  • The CM_JavaUsageTracking WMI class has been created

SCCM Java Inventory

  • Launch any application that needs Java or visits any web page that needs Java.
  • After a couple of minutes, you should have some data in the WMI classes. This confirms that the monitoring process is fully functioning

SCCM Java Inventory

Collect information using Hardware Inventory

Now that our data is in WMI, we need to instruct SCCM to gather this information in its next hardware inventory cycle.

  • Open the SCCM console and go to Administration \ Client Settings
  • Select your Default client setting and select Properties
  • Select Hardware Inventory and select Set Classes

SCCM Java Inventory

  • In the Hardware Inventory Classes window, click on Add

SCCM Java Inventory

  • Click Connect and enter the test computer name and leave the default WMI Namespace (root\cimv2)
  • A list of the inventory classes will show, find CM_JavaUsageTracking, check it and click Ok

SCCM Java Inventory

  • You can leave the inventory classes in the Default Client settings or you can enable it in a custom one if you have one
  • Make sure that the client setting is deployed to your test collection and initiate a Hardware Inventory from the Configuration Manager applet

SCCM Java Inventory

  • As in any Hardware Inventory cycle, you can validate that the new classes get inventoried in the InventoryAgent.Log

SCCM Java Inventory

  • The CM_JavaUsageLogging.log in the SCCM logs folder should show activity

SCCM Java Inventory

Java Data Verification

  • In the SCCM Console, right-click your test computer and select Start / Resource Explorer
  • You should see the CM_JavaUsageTracking classes under Hardware

SCCM Java Inventory

  • If you are familiar with SQL, a new v_GS_CM_JavaUsagetracking view has been created

SCCM Java Inventory

Report

Now that our Java tracking data is gathered by SCCM we have built an SSRS report to show which computer has run Java. You can download the free Asset – Java Inventory and Metering report by visiting our product page. Leave us your comments if you are using our report so that we can improve it over time.

Important Info
This report will work only if the above steps have been made. If you try to run the report without creating the Java view, the report will fail

SCCM Java Inventory

1 Star2 Stars3 Stars4 Stars5 Stars (4 votes, average: 5.00 out of 5)
Loading...

Share this Post

Founder of System Center Dudes. Based in Montreal, Canada, Senior Microsoft SCCM Consultant, 5 times Enterprise Mobility MVP. Working in the industry since 1999. His specialization is designing, deploying and configuring SCCM, mass deployment of Windows operating systems, Office 365 and Intunes deployments.

18 Comments on “SCCM Java Inventory and Metering”

  1. I did extend the powershell with “$Keys += Get-ChildItem “HKLM:\Software\JavaSoft\Java Runtime Environment”” to add x64 support.
    Now it is creating the “usagetracker.properties” file in x86 & x64 \Java\jre8\lib\management, also my Client is adding java usage to the database.

    Can anybody confirm?

  2. I believe the issue with not being able to monitor x64 is due to the powerscript only enumerating WOW6432 registry keys, so it only knows about 32bit installs of Java to be able to put the usagetracker.properties file in the correct location. The script needs to be modified to account for this. I did find this URL “https://docs.oracle.com/javacomponents/usage-tracker/overview/” which talks about a a central location but it only works for the latest versions.

  3. Is there a list of what the compliance states mean? When i run the Evaluation and Get the report view on the test machine, I have a compliance state: Error and Non-Compliance Severity: Critical.

  4. Hi @ all I ogt work locally, but when I use the report Asset – Java Inventory and Metering it says ” No device found” Did I something wrong? The report sees the total number of devices, but says that no device is using Java. That’s impossible.

  5. Thank you for the post and script, however I’m having issues getting it to run on my Windows 7 machines. Anyone else having issues?

    I have tried to run it directly from Powershell on some sample machines and it appears to be choking on syntax in the script. First (of many) errors are:
    You must provide a value expression on the right-hand side of the ‘+’ operator.
    At line:31 char:36

    1. I was able to figure this one out. If anyone else runs into this issue, there are extra spaces after the backtick (`) for the line breaks in lines 31-37. These extra spaces must be removed for it to run properly on Windows 7.

      1. I removed the extra spaces and have the baseline deployed to about 65 systems but still only have 2 in the report.

        1. Give it some time to run. Once Java is used on a machine and it checks in, it should appear on the report.

  6. ok, have connected it to my datasource now, but the only pc that shows data is my test pc. I have confirmed the client settings are deployed to the All Workstations collection.

    1. I have been able to get it working for Win10, but not Win7. It takes some time for the data to come in as Java has to be launched after the CM was pushed. It may take some time, so be patient with it.

  7. Hi All, I’m just having some trouble with the report step. I get this “The report server cannot process the report or shared dataset. The shared data source ‘CM_SCD’ for the report server or SharePoint site is not valid. Browse to the server or site and select a shared data source. (rsInvalidDataSourceReference)” when I try to run it from the reports portal. Have I done something wrong?
    It doesn’t appear in the list of reports in the sccm console.
    Tim

Leave a Reply

Your email address will not be published. Required fields are marked *