I need a script to silently and remotely uninstall all versions of java

D-boyD-boy Member Posts: 595 ■■□□□□□□□□
Hi All,

I need a script to silently and remotely uninstall all versions of java. I Have tried google but can't find anything that works. Anyone have one to hand?

This is for Windows Xp 34\64 and Windows 7 32\64


Thanks,
D

Comments

  • the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
    WIP:
    PHP
    Kotlin
    Intro to Discrete Math
    Programming Languages
    Work stuff
  • kgbkgb Member Posts: 380
    Why all the hate?

    We must love the Java :)
    Bachelor of Science, Information Technology (Software) - WGU
  • ptilsenptilsen Member Posts: 2,835 ■■■■■■■■■■
    What tools are at your disposal? Group Policy? SCCM or a similar management tool? Or do you need to push it out to PCs on the network or named in a list another way, ie psexec or WMI?

    I recently had to deploy specific versions of Java in SCCM, and I recall all the command-line arguments being documented on the web site. The scripting itself is fairly trivial. I do have a script or two that can be adapted for this purpose.

    In a tightly controlled environment with no identified business need for Java, I can completely see blocking it. I consider Java to be easily a top 5 attack vector on workstations -- not #1 only because it is enabled by web browsers. In most environments, though, people need Java for some sites and web applications and disabling it is not feasible.
    Working B.S., Computer Science
    Complete: 55/120 credits SPAN 201, LIT 100, ETHS 200, AP Lang, MATH 120, WRIT 231, ICS 140, MATH 215, ECON 202, ECON 201, ICS 141, MATH 210, LING 111, ICS 240
    In progress: CLEP US GOV,
    Next up: MATH 211, ECON 352, ICS 340
  • D-boyD-boy Member Posts: 595 ■■□□□□□□□□
    Group Policy and LANDesk. Thank you for your replies! They have now decided not to remove the old version of Java.
  • SlowhandSlowhand Mod Posts: 5,161 Mod
    Well damn, and here I even wrote up a little PowerShell script for you:
    $computers = Get-Content "C:\temp\computers.txt"
    
    ForEach-Object ( $computer in $computers ) {
    
    
        $java = Get-WmiObject -ComputerName $computer Win32_Product | WHERE { $_.name -like "J2SE Runtime Environment*" }
        $java.uninstall()
        
    }
    

    Just toss the list of computers, one name on each line, in the computers.txt file and you're good to go. Ah well, maybe you can use it in the future.

    Free Microsoft Training: Microsoft Learn
    Free PowerShell Resources: Top PowerShell Blogs
    Free DevOps/Azure Resources: Visual Studio Dev Essentials

    Let it never be said that I didn't do the very least I could do.
  • it_consultantit_consultant Member Posts: 1,903
    I think you can script this tool:

    JavaRa | SingularLabs
Sign In or Register to comment.