title: SCCM .cmd script will not work properly
body: <p>I have googled this like crazy, so if this has been posted before, apologies.</p>
  
  <p>I usually push updates via SCCM with .cmd scripts, so I can uninstall the previous version, and install the new version fresh.</p>
  
  <p>code:</p>
  
  <pre><code>@echo off
  
  REM Kill IE &amp; Java Processes
  cls
  echo --------------------------------------------------------
  echo       This will kill Browsers and Java Processes
  echo --------------------------------------------------------
  taskkill /F /IM iexplorer.exe
  taskkill /F /IM iexplore.exe
  taskkill /F /IM firefox.exe
  taskkill /F /IM chrome.exe
  taskkill /F /IM jusched.exe
  taskkill /F /IM jp2launcher.exe
  taskkill /F /IM java.exe
  taskkill /F /IM javaw.exe
  taskkill /F /IM jqs.exe
  
  REM Uninstalling Old JRE Versions
  cls
  echo --------------------------------------------------------
  echo.              DO NOT CLOSE THIS WINDOW
  echo. All the Java versions from your computer are being removed.
  echo --------------------------------------------------------
  wmic product where "name like 'J2SE%%'" call uninstall
  wmic product where "name like 'Java 2%%'" call uninstall
  wmic product where "name like 'Java 3%%'" call uninstall
  wmic product where "name like 'Java 4%%'" call uninstall
  wmic product where "name like 'Java 5%%'" call uninstall
  wmic product where "name like 'Java(TM) 6%%'" call uninstall
  wmic product where "name like 'Java 7%%'" call uninstall
  wmic product where "name like 'Java 8%%'" call uninstall
  
  REM Installing Java 1.8u77
  cls
  echo --------------------------------------------------------
  echo .
  echo .
  echo .      Installing Java Runtime Environment - Please Wait.
  echo .         (This window will close once installed)
  echo .
  
  mkdir c:\programdata\oracle\java
  mkdir "c:\windows\sun\java\deployment"
  copy  java.settings.cfg c:\programdata\Oracle\Java\java.settings.cfg   &gt;&gt;c:\programdata\oracle\java\copylog.log
  
  REM Installing JRE 32-bit
  "%~dp0jre-8u77-windows-i586.exe" INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_ANALYTICS=0 EULA=0 REBOOT=0
  
  REM If 64-bit Windows JRE 64-bit is also required
  REM Installing JRE 64-bit
  if exist "%ProgramFiles(x86)%\" "%~dp0jre-8u77-windows-x64.exe" INSTALL_SILENT=1 STATIC=0 AUTO_UPDATE=0 WEB_JAVA=1 WEB_ANALYTICS=0 EULA=0 REBOOT=0
  
  REM Disable automatic updates
  reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v SunJavaUpdateSched /f
  reg add "HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 0 /f
  
  copy deployment.config c:\windows\sun\java\deployment\deployment.config   &gt;&gt;c:\programdata\oracle\java\copylog.log
  copy deployment.properties c:\windows\sun\java\deployment\deployment.properties   &gt;&gt;c:\programdata\oracle\java\copylog.log
  copy exception.sites c:\windows\sun\java\deployment\exception.sites   &gt;&gt;c:\programdata\oracle\java\copylog.log
  
  REM Return exit code to SCCM
  exit /B %EXIT_CODE%
  </code></pre>
  
  <p>For some reason, it only ever installs the 64 bit version, never both. I have done this as a Package and Application, same result. I've removed the "if exist "%ProgramFiles(x86)%\"" portion, nothing. I've created separate deployments and called the 32 bit first, nothing.</p>
  
  <p>I'm kind lost as to why its only installing the 64-bit version.</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>Thanks</p>
  
  <p>EDIT: And yes, I have tested it locally, the script works great when not deployed via SCCM</p>
  
  <p>EDIT: I am attempting to deploy this script to Windows 8.1 and 7 machines, from a SCCM 2012 R2 server. I have deployed with this format before, and as experience dictates, sometimes things get bent out of shape with new programs. </p>