echo off
setlocal ENABLEDELAYEDEXPANSION
if exist "C:\Program Files\Google\Chrome\Application\chrome.exe" (GOTO IS_INSTALLED) else (GOTO INSTALL_UPGRADE)
GOTO INSTALL_UPGRADE
:IS_INSTALLED
echo is installed
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 208 /D "%~0 -- Google Chrome is already installed - Upgrading"
GOTO INSTALL_UPGRADE
:INSTALL_UPGRADE
echo installing software
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 404 /D "%~0 -- Google Chrome -- downloading now…"
mkdir C:\TEMP
if not exist C:\TEMP\googlechromestandaloneenterprise64.msi (curl -C - -o C:\TEMP\googlechromestandaloneenterprise64.msi "https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B43D21052-653F-075A-0A75-3135595329EE%7D%26lang%3Den%26browser%3D0%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26ap%3Dx64-stable-statsdef_0%26brand%3DGCEA/dl/chrome/install/googlechromestandaloneenterprise64.msi")
if not exist C:\TEMP\googlechromestandaloneenterprise64.msi ( eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 404 /D "%~0 -- Google Chrome -- copy/download failed…"
goto DONE
)
REM 99.0.4844.82 {F28017C0-8D37-4EEF-BA41-C0A547A31DC6}
reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall{61CACCEF-43A5-32E8-AB24-BE4EEEE886F7}
set install_level=%errorlevel%
if %install_level%==0 (echo is installed
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 200 /D "%~0 -- Google Chrome is already installed"
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update /v AutoUpdateCheckPeriodMinutes /t REG_DWORD /d 120 /f
GOTO DONE
)
if %install_level%==1 (
eventcreate /L APPLICATION /T INFORMATION /SO %~n0%~x0 /ID 208 /D "%~0 -- Google Chrome -- installing NOW"
start /wait msiexec /qn /i C:\TEMP\googlechromestandaloneenterprise64.msi /L*V "C:\TEMP\SW_GoogleChrome.log"
)
GOTO DONE
:DONE
exit