I hate supersedence...

If you install stuff with a Powershell script you can throw this at the
beginning:

Function Uninstall-MSIFromGUID {
    Param (
        $SoftwareName,
        $64Only = $false,
        $32Only = $false
    )
    $HKLMSoftware = $false
    $HKLMSoftwareWow6432 = $false
    $OsArch = (Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture |
Out-String
    if ($OsArch.Contains("64")) {
        If (!($32Only)) { $HKLMSoftware = $true }
        if (!($64Only)) { $HKLMSoftwareWow6432 = $true }
    }
    else {
        If (!($64Only)) { $HKLMSoftware = $true }
        $HKLMSoftwareWow6432 = $false
    }
    If ($HKLMSoftware) {
        Get-ChildItem
"hklm:\software\microsoft\windows\currentversion\uninstall" |
ForEach-Object {
            $ItemProperties = Get-ItemProperty $_.PSPath
            $DisplayName = $ItemProperties.DisplayName
            If ($DisplayName -eq $null) { $DisplayName = "" }
            If ($DisplayName.ToLower().Contains($SoftwareName.ToLower())) {
                $KeyName = $_.Name
                $KeyName = $KeyName.Split("\")
                $KeyName = $KeyName[$KeyName.count-1]
                If ($KeyName.contains("{")) {
                    msiexec /x $KeyName /qn REBOOT=REALLYSUPPRESS | Out-Null
                }
            }
        }
    }
    If ($HKLMSoftwareWow6432) {
        Get-ChildItem
"hklm:\software\wow6432Node\microsoft\windows\currentversion\uninstall" |
ForEach-Object {
            $ItemProperties = Get-ItemProperty $_.PSPath
            $DisplayName = $ItemProperties.DisplayName
            If ($DisplayName -eq $null) { $DisplayName = "" }
            If ($DisplayName.ToLower().Contains($SoftwareName.ToLower())) {
                $KeyName = $_.Name
                $KeyName = $KeyName.Split("\")
                $KeyName = $KeyName[$KeyName.count-1]
                If ($KeyName.contains("{")) {
                    msiexec /x $KeyName /qn REBOOT=REALLYSUPPRESS | Out-Null
                }
            }
        }
    }
}

Then call the function with this command:
Uninstall-MSIFromGUID -SoftwareName "Java"

If you want to uninstall only from the 32 or 64-bit hive, use the switches.
It does a case insensitive search for the program name you specify.

Test the function on your applications before it runs. It uses the
uninstall key name to build the uninstall string as opposed to the
Uninstall field. This way it should work on applications that don't fill
out the uninstall value.



On Tue, Mar 10, 2015 at 4:59 PM, Justin Chalfant <
[email protected]> wrote:

>  Using the Uninstall WMIC method will reconfigure all products look at
> the application log in event viewer. You may want to check out my blog
> here:
> http://blogs.technet.com/b/jchalfant/archive/2014/05/13/uninstalling-all-previous-versions-of-java-runtime-environment-using-application-supersedence-in-configuration-manager.aspx
>
>
>
> Thanks,
>
>
>
> *Justin Chalfant*
>
> Premier Field Engineer – Configuration Manager
>
> Public Sector
>
> Microsoft Services
>
>
>
> Tel : (303) 846-2701
>
> Email:     [email protected]
>
>
>
> If you have any feedback about my work, please let either myself or my
> manager Rusty Gray know at [email protected]
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Nash Pherson
> *Sent:* Tuesday, March 10, 2015 3:10 PM
> *To:* [email protected]
> *Subject:* RE: [mssms] java uninstall with wmic
>
>
>
> Does that cover ‘Java(TM) 6 Update 2’ entries (half of java 6 and the
> first couple java 7’s had the TM in the name).
>
>
>
> Nash
>
>
>
>
>
> *From:* [email protected] [
> mailto:[email protected] <[email protected]>] *On
> Behalf Of *Ryan
> *Sent:* Tuesday, February 24, 2015 13:47 PM
> *To:* [email protected]
> *Subject:* Re: [mssms] java uninstall with wmic
>
>
>
> That will uninstall all Java, even the JDK. ConfigMgr to see the patterns
> of Java names in your environment. I was able to get away with this:
>
> Name Like 'Java _ Update%'
>
>
>
> On Tue, Feb 24, 2015 at 1:42 PM, Timothy Ransom <
> [email protected]> wrote:
>
>  Hi,
>
>
>
> I finally have ok to upgrade a group of 2k PCs to latest Java but many
> have multiple versions.
>
>
>
> Has anyone used wmic from ConfigMgr to uninstall Java?
>
>
>
> No issues using this command locally to remove multiple versions.
>
> wmic product where “name like ‘Java%'” call uninstall
>
>
>
> Thanks,
>
> Tim
>
>
>
>
> **********************************************************************************************
> GDOL CONFIDENTIALITY NOTICE: This transmission may contain confidential
> information protected by state or federal law. The information is intended
> only for use consistent with the state business discussed in this
> transmission. If you are not the intended recipient, you are hereby
> notified that any disclosure, copying, distribution, or the taking of any
> action based on the contents is strictly prohibited. If you have received
> this transmission in error, please delete this email and notify the sender
> immediately. Your cooperation is appreciated.
>
> **********************************************************************************************
>
>
>
>
>
>
>
>
>
>



Reply via email to