none
Application package detection method RRS feed

  • Question

  • Hi,

    I am attempting to run a Oracle Java JRE remediation. Our organization has decided to allow devices to only have JRE 8u202 installed. All other versions on a device must be removed. This will mean upgrading versions lower than 8u202 and downgrading versions higher than 8u202. I have a PowerShell script that handles this exactly the way we decided to address the issue. The script is testing consistently without any issues and now I need to put it in an application package.

    There are devices that have 8u202 installed but may also have multiple other versions installed at the same time. I initially set the detection method to look for a specific path (C:\Program Files (x86)\Java\jre1.8.0_202). The problem with this approach is that if a computer has 8u202 installed, the package is not going to run on that device even when versions other than 8u202 are installed at the same time.

    Does anyone have suggestions on how to get this to work with an application package? I need the package to run on all computers in a query based collection that contains the exact target devices that need to run the package. I know I could do this with just a package (not application package) but our organization prefers application packages. Detection methods don't allow for scripts to make the call which would simplify this approach (such as - Installed Java instances > 1).

    Thank you!

    Rob

    Monday, November 25, 2019 4:22 PM

Answers

  • Hi robwm1

    Sounds like an interesting one :)

    I would go for a custom PowerShell detection method, something like the second script in this gallery or you could write your own that just queries the uninstall key in the registry.

    https://gallery.technet.microsoft.com/scriptcenter/519e1d3a-6318-4e3d-b507-692e962c6666

    At the bottom of the script you could then add on something like:

    $Java_versions = Get-InstalledSoftware | Where-Object -Property Name -Like '*Java*' | Select-Object -Property Name, Version
    $Required_version = $Java_versions | Where-Object -Property Name -Match 'Java 8 Update 144'
    
    
    if ($Java_versions.count -eq '2' -and $Required_version.count -eq '2') {
        Write-Host 'Detected'
    } else {
    
    }

    That would make sure only both your required versions are returned. Obviously substitute for your version.

    As you are into PowerShell its really worth checking out the PSAPPDeploytoolkit. It already has things like removing specific versions of Java built in.


    Richard Knight | Collection Refresh Manager | Automate detection rules for patch \ msp files | Twitter

    • Marked as answer by robwm1 Monday, November 25, 2019 8:09 PM
    Monday, November 25, 2019 6:05 PM

All replies

  • Hi robwm1

    Sounds like an interesting one :)

    I would go for a custom PowerShell detection method, something like the second script in this gallery or you could write your own that just queries the uninstall key in the registry.

    https://gallery.technet.microsoft.com/scriptcenter/519e1d3a-6318-4e3d-b507-692e962c6666

    At the bottom of the script you could then add on something like:

    $Java_versions = Get-InstalledSoftware | Where-Object -Property Name -Like '*Java*' | Select-Object -Property Name, Version
    $Required_version = $Java_versions | Where-Object -Property Name -Match 'Java 8 Update 144'
    
    
    if ($Java_versions.count -eq '2' -and $Required_version.count -eq '2') {
        Write-Host 'Detected'
    } else {
    
    }

    That would make sure only both your required versions are returned. Obviously substitute for your version.

    As you are into PowerShell its really worth checking out the PSAPPDeploytoolkit. It already has things like removing specific versions of Java built in.


    Richard Knight | Collection Refresh Manager | Automate detection rules for patch \ msp files | Twitter

    • Marked as answer by robwm1 Monday, November 25, 2019 8:09 PM
    Monday, November 25, 2019 6:05 PM
  • Hi Richard,

    I don't see any way to use a PowerShell based detection method for an application package. Choices appear to be MSI Installer, file or registry. Am I missing something? Your suggestion is valid for Configuration Items for sure.

    I have existing code that will return the number of Java instances found in the registry, so I'm good there.

    UPDATED:

    Richard, I see where I can use a PowerShell script in the detection method now. Thank you for your info!!

    -Rob




    • Edited by robwm1 Monday, November 25, 2019 7:09 PM
    Monday, November 25, 2019 6:46 PM
  • Hi,

    Thank you very much for posting question here and we're glad the problem is solved now. If you have any questions in future, we warmly welcome you to post in this forum again.

    Best regards,
    Larry


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, November 28, 2019 9:36 AM