anchor.diff:  :: Purpose:       Installs a package
   :: Requirements:  Run this script with Administrator rights
   :: Author:        vocatus on reddit.com/r/sysadmin ( vocatus.gate@gmail.com ) // PGP key ID: 0x07d1490f82a211a2
  -:: History:       1.0.0 + Initial write
  +:: History:       1.0.1 + Add proper console and logfile logging
  +::                1.0.0 + Initial write
   
   
   ::::::::::
   :: Prep :: -- Don't change anything in this section
   ::::::::::
   @echo off
  -set SCRIPT_VERSION=1.0.0
  -set SCRIPT_UPDATED=2017-10-04
  +set SCRIPT_VERSION=1.0.1
  +set SCRIPT_UPDATED=2020-02-05
   :: Get the date into ISO 8601 standard date format (yyyy-mm-dd) so we can use it
   FOR /f %%a in ('WMIC OS GET LocalDateTime ^| find "."') DO set DTS=%%a
   set CUR_DATE=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%
  
positive.code: :: VARIABLES :: -- Set these to your desired values
  :::::::::::::::
  :: Log location and name. Do not use trailing slashes (\)
  set LOGPATH=%SystemDrive%\Logs
  set LOGFILE=jdk10_x64_update.log
  
  :: Package to install. Do not use trailing slashes (\)
  set LOCATION=
  set BINARY=jdk-11.0.2_windows-x64.exe
  set FLAGS=/s /l %LOGPATH%\%LOGFILE% ADDLOCAL="ToolsFeature"
  
  :: Create the log directory if it doesn't exist
  
negative.code: ::::::::::::::::::
  :: INSTALLATION ::
  ::::::::::::::::::
  :: Remove previous versions of the JDK, series 11
  echo %CUR_DATE% %TIME% Removing previous versions, please wait...
  echo %CUR_DATE% %TIME% Removing previous versions, please wait...>> "%LOGPATH%\%LOGFILE%" 2>NUL
  wmic product where "IdentifyingNumber like '{41150763-08D2-5FDA-90D8-20618BEA61D0}'" call uninstall /nointeractive>> "%LOGPATH%\%LOGFILE%" 2>NUL
  wmic product where "IdentifyingNumber like '{4AC8DBB2-1AE5-5156-83F9-D4E2E6DD564B}'" call uninstall /nointeractive>> "%LOGPATH%\%LOGFILE%" 2>NUL
  :: Do the removal by name instead of GUID
  wmic product where "name like 'Java%%SE Development Kit 11%%(64-bit)'" uninstall /nointeractive>> "%LOGPATH%\%LOGFILE%" 2>NUL
  echo %CUR_DATE% %TIME% Done.
  echo %CUR_DATE% %TIME% Done.>> "%LOGPATH%\%LOGFILE%" 2>NUL
  
  
  :: Install the package from a local folder (if all files are in the same directory)
  echo %CUR_DATE% %TIME% Installing package...
  echo %CUR_DATE% %TIME% Installing package...>> "%LOGPATH%\%LOGFILE%" 2>NUL
  "%BINARY%" %FLAGS%
  echo %CUR_DATE% %TIME% Done.
  echo %CUR_DATE% %TIME% Done.>> "%LOGPATH%\%LOGFILE%" 2>NUL
  
  
  echo %CUR_DATE% %TIME% Disabling telemetry and cleaning up...
  echo %CUR_DATE% %TIME% Disabling telemetry and cleaning up...>> "%LOGPATH%\%LOGFILE%" 2>NUL
  :: Import the reg file that disables Java auto-updater
  regedit /s Tweak_Disable_Java_Auto-Update.reg >> %LOGPATH%\%LOGFILE% 2>nul
  
  