{"id":2115,"date":"2015-01-28T18:42:59","date_gmt":"2015-01-28T23:42:59","guid":{"rendered":"http:\/\/batchpatch.com\/?p=2115"},"modified":"2015-02-04T23:35:47","modified_gmt":"2015-02-05T04:35:47","slug":"uninstalling-java-remotely-from-numerous-computers","status":"publish","type":"post","link":"https:\/\/batchpatch.com\/uninstalling-java-remotely-from-numerous-computers","title":{"rendered":"Uninstalling Java Remotely from Numerous Computers"},"content":{"rendered":"<p>One task that nearly every administrator has to complete at some point or another is the removal of Java.  As with many typical sysadmin tasks, removing software on remote computers is very quick and simple with BatchPatch.  Today I&#8217;d like to show you how to remove Java from many computers using BatchPatch.  We have a few different options for executing the uninstallation, so take a look through all options before deciding which one you want to use.  <strong>IMPORTANT: Always test a destructive process like this on a non-production machine before you attempt to perform an action on one or many production machines!<\/strong><\/p>\n<h2 class=\"brownishOrange\">Method 1 (Preferred Method): Uninstall a specific Java version, by UninstallString:<\/h2>\n<ol>\nThis method provides more precision since it uses the exact uninstall string for the application instead of a name search.  However, it also requires a bit more effort.<\/p>\n<li>First we need to locate the UninstallString value in the registry for the version of Java that we want to remove.  Generally one of the following two registry keys will contain the UninstallString value that we are looking for:<br \/>\n<br \/>\n<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall<\/code><br \/>\n<strong>OR<\/strong><br \/>\n<code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall<\/code><br \/>\n<br \/>\nOn my test machine I located the UninstallString value for Java 8 Update 31, and it contains the following data:<br \/>\n<code>MsiExec.exe \/I{26A24AE4-039D-4CA4-87B4-2F83218031F0}<\/code><br \/>\n\n<\/li>\n<li>In BatchPatch, highlight the target hosts and select <strong><em>&#8216;Actions > Execute remote process\/command > Create\/modify remote command 1&#8217;<\/em><\/strong>.  Enter the following syntax into the command field, substituting the correct string for the particular version of Java that you are uninstalling:<br \/>\n<code>MsiExec.exe \/qn \/X{26A24AE4-039D-4CA4-87B4-2F83218031F0} \/norestart<\/code><\/li>\n<li>Click the &#8216;Execute&#8217; button<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_18_25-new-4-BatchPatch-X1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_18_25-new-4-BatchPatch-X1.png\" alt=\"2015-01-28 18_18_25-new 4 - BatchPatch X1\" width=\"667\" height=\"417\" class=\"aligncenter size-full wp-image-2128\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_18_25-new-4-BatchPatch-X1.png 667w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_18_25-new-4-BatchPatch-X1-300x188.png 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/a>\n<\/li>\n<li>In the &#8216;All Messages&#8217; column we see exit code 0, which indicates success.<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_19_32-new-4-BatchPatch-X1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_19_32-new-4-BatchPatch-X1.png\" alt=\"2015-01-28 18_19_32-new 4 - BatchPatch X1\" width=\"667\" height=\"417\" class=\"aligncenter size-full wp-image-2129\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_19_32-new-4-BatchPatch-X1.png 667w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_19_32-new-4-BatchPatch-X1-300x188.png 300w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/a>\n<\/li>\n<\/ol>\n<p><!--LINE SEPARATOR--><\/p>\n<hr style=\"border-top: 1px solid white; border-bottom: 1px solid gray; width:100%;\"<\/hr>\n<p><!--LINE SEPARATOR--><\/p>\n<h2 class=\"brownishOrange\">IMPORTANT NOTE:<\/h2>\n<p><strong>Methods 2 and 3 should be used with caution.<\/strong>  Both of the following uninstallation methods utilize the Win32_Product class.  However, before proceeding with either method, please review <a href=\"http:\/\/csi-windows.com\/toolkit\/win32product-replacement\" title=\"Win32_Product class issues\" target=\"_blank\">this article<\/a> to learn why some sysadmins are opposed to using the Win32_Product class.<\/p>\n<h2 class=\"brownishOrange\">Method 2: Uninstall a specific Java version, by name query:<\/h2>\n<ol>\n<li>In BatchPatch, highlight the target hosts and select <strong><em>&#8216;Actions > Execute remote process\/command > Create\/modify remote command 3 (logged output)&#8217;<\/em><\/strong>.  Enter the following syntax into the command field, substituting the version of Java that you want to remove.  Make sure that the name you use matches the exact name that appears in the &#8216;Add\/Remove Programs&#8217; wizard on the target computer(s):<br \/>\n<code>wmic product where (name = 'Java 8 Update 31') call uninstall<\/code><\/li>\n<li>Click the &#8216;Execute&#8217; button<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_13_18-new-2-BatchPatch-X1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_13_18-new-2-BatchPatch-X1.png\" alt=\"2015-01-28 18_13_18-new 2 - BatchPatch X1\" width=\"665\" height=\"417\" class=\"aligncenter size-full wp-image-2124\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_13_18-new-2-BatchPatch-X1.png 665w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_13_18-new-2-BatchPatch-X1-300x188.png 300w\" sizes=\"auto, (max-width: 665px) 100vw, 665px\" \/><\/a>\n<\/li>\n<li>You can see in the screenshot below that this command returns successfully with exit code 0.  Also, the &#8216;Remote Command Output Log&#8217; column shows the output that was returned by the target, giving us additional confirmation of what was executed.<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_01_40-Program-Manager.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_01_40-Program-Manager-1024x385.png\" alt=\"2015-01-28 18_01_40-Program Manager\" width=\"540\" height=\"203\" class=\"aligncenter size-large wp-image-2118\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_01_40-Program-Manager-1024x385.png 1024w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_01_40-Program-Manager-300x113.png 300w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_01_40-Program-Manager.png 1112w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a>\n<\/li>\n<\/ol>\n<h2 class=\"brownishOrange\">Method 3: Uninstall all versions of Java, by name query<\/h2>\n<p>Method 3 and Method 1 are similar, except we change the query in Method 3 to include all software products on the computer that begin with the name &#8216;Java&#8217;<\/p>\n<ol>\n<li>In BatchPatch, highlight the target hosts and select <strong><em>&#8216;Actions > Execute remote process\/command > Create\/modify remote command 3 (logged output)&#8217;<\/em><\/strong>.  Enter the following syntax into the command field:<br \/>\n<code>wmic product where (name like 'Java%') call uninstall<\/code><\/li>\n<li>Click the &#8216;Execute&#8217; button<br \/>\n<a href=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_24_41-new-5-BatchPatch-X1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_24_41-new-5-BatchPatch-X1.png\" alt=\"2015-01-28 18_24_41-new 5 - BatchPatch X1\" width=\"666\" height=\"417\" class=\"aligncenter size-full wp-image-2131\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_24_41-new-5-BatchPatch-X1.png 666w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_24_41-new-5-BatchPatch-X1-300x188.png 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/a>\n<\/li>\n<li>You can see in the screenshot below that this command returns successfully with exit code 0.  Also, the &#8216;Remote Command Output Log&#8217; column shows the output that was returned by the target, giving us additional confirmation of what was executed.  Note, in this case every app on the computer that has a name beginning with &#8216;Java&#8217; is removed.  The reason we see a return code of 1605 for the &#8216;Java Auto Updater&#8217; is because the Java uninstallation was executed first, and the Java Auto Updater was removed as part of the Java uninstallation.  WMIC didn&#8217;t know that, of course, so when it tried to remove &#8216;Java Auto Updater,&#8217; it returned 1605, because &#8216;Java Auto Update&#8217; was already removed.  1605 translates to <code>ERROR_UNKNOWN_PRODUCT - This action is only valid for products that are currently installed<\/code>.<br \/>\n<a href=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_26_10-new-5-BatchPatch-X1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"\/wp-content\/uploads\/2015\/01\/2015-01-28-18_26_10-new-5-BatchPatch-X1.png\" alt=\"2015-01-28 18_26_10-new 5 - BatchPatch X1\" width=\"861\" height=\"417\" class=\"aligncenter size-full wp-image-2132\" srcset=\"https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_26_10-new-5-BatchPatch-X1.png 861w, https:\/\/batchpatch.com\/wp-content\/uploads\/2015\/01\/2015-01-28-18_26_10-new-5-BatchPatch-X1-300x145.png 300w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/a>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>One task that nearly every administrator has to complete at some point or another is the removal of Java. As with many typical sysadmin tasks, removing software on remote computers is very quick and simple with BatchPatch. Today I&#8217;d like to show you how to remove Java from many computers using BatchPatch. We have a [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1,17,3],"tags":[107,73],"class_list":["post-2115","post","type-post","status-publish","format-standard","hentry","category-blog","category-general","category-tutorials","tag-java","tag-uninstall"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/2115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/comments?post=2115"}],"version-history":[{"count":16,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/2115\/revisions"}],"predecessor-version":[{"id":2136,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/posts\/2115\/revisions\/2136"}],"wp:attachment":[{"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/media?parent=2115"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/categories?post=2115"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/batchpatch.com\/wp-json\/wp\/v2\/tags?post=2115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}