SCCM Java Inventory and Metering

Benoit LecoursSCCM59 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

[ratings]

Share this Post

59 Comments on “SCCM Java Inventory and Metering”

  1. HI,

    Thank you for the post! After following the steps for the first part. I ran evaluation on a test computer. I got Compliance state “error”

    Evaluation Time:
    6/29/2021 6:27:42 PM

    Baseline Name:
    Java Usage Tracking

    Revision:
    3

    Compliance State:
    Error

    Non-Compliance Severity:
    Critical

    Description:
    Java software metering. http://docs.oracle.com/javacomponents/usage-tracker/overview/index.html

    There is no usagetracker.properties or CM log either. Could you please advise?

    Thank you!

  2. I think this is among the most vital information for me.
    And i’m glad reading your article. But want to remark on some general things, The web site style is perfect, the articles
    is really nice : D. Good job, cheers

  3. “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”

    Can you please verify this? On 3 test machines so far java is installed but not running until called from another program. Once closed java closes as well. Thank you.

    1. It looks like some of the Java information has leading or trailing whitespace. I edited the query in the dataset to change instances of = ‘something’ to LIKE ‘%something%’ to account for leading or trailing whitespace.

      Here’s the content of the case statement I changed.

      CASE WHEN CMJ.Type0 like ‘%plugin2%’ THEN ‘Applet’ WHEN CMJ.Type0 like ‘%VM Start%’ THEN ‘Java application’ WHEN CMJ.Type0 like ‘%javaws%’ THEN ‘Java Web Start’ WHEN CMJ.Type0 like ‘%denied%’ THEN ‘Denied’ ELSE ‘NULL’ END As Type,

  4. Nice read but needing a “Commercial License” to use is complete do-do by Oracle. To have feature that’s in your free product only to enable this feature now makes it subscription based. Complete garbage.

  5. Any thoughts on why the report would only return info on one client, it is deployed to all workstation clients? But seems to only return results for a single client.

  6. I am relatively new to SCCM reporting and I am unsure of how to switch the Report Server URL in the free report from their generic http://sccm2012/ReportServer, to the URL for my actual server. I can’t edit the Built-in Fields, and when I go to Parameters and go to Default Values > Specify Values and enter the URL, that doesn’t work either.

  7. For anyone who gets an error instead of a warning when looking at the component report;
    You might need to change your powershell execution policy. Default policy blocks the script I used (I used the one Chris Kibble wrote). A different approach would be to sign the script before using it.

    Hope this helped anyone!

  8. Hey there. I’ve deployed the baseline as outlined in the instructions. Some machines seem to run it fine, but there are some that are coming up with an error “0x8007001 – Incorrect Function”. I am not a PS guru by any means. Any ideas what would be causing this?

  9. Is there a way to trigger down results?
    I mean, to know how many licenses you will need – you will only have to know how many apps are using java pro computer.
    Now how many times it’s started.
    So you should be able to filter down the whole thing and know: this computer has started java from 5 different locations, which means it will need 5 licenses.
    Is there a way to accomplish this?

    1. EDIT: Apparently you can put the usagetracker.properties inside: %PROGRAMDATA%\Oracle\Java
      With this in place also embedded java are writing to the log.
      I’m still testing it but it seems to work.

      Apart from that – there is a Central File System Location where you can put the usagetracker.properties and it should track ALL installed java versions (except embedded).
      Why is this not used inside the script?

      Cheers

      1. EDIT2:
        So after a little testing I’ve found out that you should put the usagetracker.properties

        C:\ProgramData\Oracle\Java [in my environment was needed for a couple of software with embedded java]

        C:\Program Files\Java\conf [is the Central File System Location for Java, it should enable logging for each installed Java version – was also needed for software which had embedded java + software which used the installed Java]

        C:\Program Files\Java\JRE\Management [if you don’t use the central file system location, you can enable logging
        version specific for x64 Java]

        C:\Program Files (x86)\Java\JRE\Management [if you don’t use the central file system location, you can enable
        logging version specific for x86 Java]

        Maybe this can be helpful for someone
        Cheers

  10. Will the metering script work for OpenJDK installations such as Red Hat?
    We have used this process to eliminate 95% of our Java installations and are looking to replace even more with Red Hat OpenJDK. I can see in the CM_JavaUsageLogging that it is detecting the JRE path for Red Hat and is placing the usagetracker.properties file in the correct location, but I am not seeing any usage being reported for systems that I know are using java apps or services.

  11. To fix the null value edit the Query in report and remove the spaces before ‘ plugin’ and ‘ VM Start’ –> ‘plugin’ and ‘VM Start’

    1. I’ve tried what you suggested but I still have null values.
      Changed:
      CASE WHEN CMJ.Type0 = ‘ plugin2’ THEN ‘Applet’ WHEN CMJ.Type0 = ‘ VM Start’
      to
      CASE WHEN CMJ.Type0 = ‘plugin2’ THEN ‘Applet’ WHEN CMJ.Type0 = ‘VM Start’

      But nothing changed

Leave a Reply