{"id":17,"date":"2016-12-26T10:39:23","date_gmt":"2016-12-26T09:39:23","guid":{"rendered":"http:\/\/blog.van-daag.nl\/?p=17"},"modified":"2017-07-25T18:24:07","modified_gmt":"2017-07-25T18:24:07","slug":"remove-java-and-install-latest-version","status":"publish","type":"post","link":"https:\/\/van-daag.nl\/?p=17","title":{"rendered":"Remove Java and install Latest Version"},"content":{"rendered":"<p>At the company where I work we don&#8217;t have full domain rights. There is no SCCM Server. There is an other software deploy program that we only have rights to send it to computers, not to create packages. So I create my own scripts to update computers.<\/p>\n<p>This script I use to update Java on all computers. Windows 7 and Windows 10.<\/p>\n<pre class=\"lang:batch decode:true\" title=\"InstallJava.cmd\">@echo off\r\nREM #########################################\r\nREM ##### Created by Daag van der Meer  #####\r\nREM ##### http:\/\/blog.van-daag.nl       #####\r\nREM ##### Filename InstallJava.cmd      #####\r\nREM #########################################\r\nPING 1.1.1.1 -n 1 -w 900 &gt;NUL\r\n\r\nSET JavaFile=&lt;JAVAFilename.msi&gt;\r\nSET JavaLoc=\\\\&lt;Java MSI Location\\Java\\Update\r\nSET LOGLOC=%Systemdrive%\\logs\r\n\r\nREM ############### Create Log Dir ###################\r\nmkdir %LOGLOC%\r\nattrib +s +h %Systemdrive%\\logs\r\nGoto INSTALL\r\n\r\n:INSTALL\r\nREM ######## Check Java Installed #############\r\nset Logfile=%LOGLOC%\\%JavaFile%.log\r\nif not exist \"%Logfile%\" (\r\necho Java is Installed on %date% at %time% &gt;&gt; %LogFile%\r\nGOTO JAVASTART)\r\n\r\nGOTO END\r\n\r\n:JAVASTART\r\nREM ###### Uninstall All Java versions ####\r\nEcho Removing All Java Versions\r\nwmic product where \"name like 'Java%%'\" call uninstall \/nointeractive\r\n\r\nREM Java Silent Install version 8111 (replace with your java version downloaded)\r\nEcho Installing Java\r\ncopy %JavaLoc%\\%JavaFile% %LOGLOC%\r\nstart \/wait msiexec.exe \/i %LOGLOC%\\%JavaFile% JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No\r\ndel %LOGLOC%\\%JavaFile%\r\n\r\nREM Disable Auto Update\r\necho Disable Auto Updates\r\nreg delete \"HKLM\\SOFTWARE\\JavaSoft\\Java Update\\Policy\\jucheck\" \/v \"UpdateSchedule\" \/f\r\nreg delete \"HKLM\\SOFTWARE\\JavaSoft\\Java Update\\Policy\\jucheck\" \/v \"UpdateMin\" \/f\r\nreg add \"HKLM\\SOFTWARE\\JavaSoft\\Java Update\\Policy\" \/v EnableJavaUpdate \/t REG_DWORD \/d 00000000 \/f\r\nreg add \"HKLM\\SOFTWARE\\JavaSoft\\Java Update\\Policy\" \/v EnableAutoUpdateCheck \/t REG_DWORD \/d 00000000 \/f\r\nreg add \"HKCU\\SOFTWARE\\JavaSoft\\Java Update\\Policy\" \/v EnableJavaUpdate \/t REG_DWORD \/d 00000000 \/f\r\n\r\nreg delete \"HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Update\\Policy\\jucheck\" \/v \"UpdateSchedule\" \/f\r\nreg delete \"HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Update\\Policy\\jucheck\" \/v \"UpdateMin\" \/f\r\nreg add \"HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Update\\Policy\" \/v EnableJavaUpdate \/t REG_DWORD \/d 00000000 \/f\r\nreg add \"HKLM\\SOFTWARE\\Wow6432Node\\JavaSoft\\Java Update\\Policy\" \/v EnableAutoUpdateCheck \/t REG_DWORD \/d 00000000 \/f\r\n\r\nGoto END\r\n:NO\r\ndel %LOGLOC%\\%JavaFile%.log\r\n\r\n:END<\/pre>\n<p>Add this script to the machine policy.<img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-31 size-full\" src=\"https:\/\/i0.wp.com\/blog.van-daag.nl\/wp-content\/uploads\/2016\/12\/unnamed-1.png?resize=640%2C100\" alt=\"\" width=\"640\" height=\"100\" srcset=\"https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2016\/12\/unnamed-1.png?w=1287&amp;ssl=1 1287w, https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2016\/12\/unnamed-1.png?resize=300%2C47&amp;ssl=1 300w, https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2016\/12\/unnamed-1.png?resize=768%2C121&amp;ssl=1 768w, https:\/\/i0.wp.com\/van-daag.nl\/wp-content\/uploads\/2016\/12\/unnamed-1.png?resize=1024%2C161&amp;ssl=1 1024w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>When a computer has the login screen this batch file runs and removes \/ installs Java.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>At the company where I work we don&#8217;t have full domain rights. There is no SCCM Server. There is an other software deploy program that we only have rights to send it to computers, not to create packages. So I create my own scripts to update computers. This script I use to update Java on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-ms-dos-scripts"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":2,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":222,"href":"https:\/\/van-daag.nl\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/222"}],"wp:attachment":[{"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/van-daag.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}