@echo off setlocal Rem Written by David Harper Rem Moddified by Ollie Green Rem Script to install Sophos SGN Rem Version 2 Rem Rem This script comes as is and has no warranty Rem set source="\\servername and path" set target=C:\sophos\install set preinstall=1_SGxClientPreinstall.msi set x64install=2_SGNClient_x64.msi set configinstall=3_SGNConfig.msi set x64patch=Build28.msp set hotfix=Hotfix1901x64.msp Rem ------------------------- Do not change below this line ---------------------------------- Rem cd /d C: Rem figuring out the OS from the version number for /f "tokens=4-5 delims=. " %%i in ('ver') do set VERSION=%%i.%%j if "%version%" == "10.0" ( set floatos=Win10 set above7=True ) if "%version%" == "6.3" ( set floatos=Win8.1 set above7=True ) if "%version%" == "6.2" ( set floatos=Win8 set above7=True ) if "%version%" == "6.1" ( set floatos=Win7 set above7=False ) if "%version%" == "6.0" ( set floatos=WinVista set above7=False ) if "%version%" == "5.2" ( set floatos=WinXp set above7="False" ) if "%version%" == "5.1" ( set floatos=WinXp set above7=False ) rem Checking OS bitness IF EXIST "%ProgramFiles(x86)%" ( set floatbit=64 echo 64 ) ELSE ( set floatbit=32 echo 32 ) rem Exiting if WinXP or Vista if "floatos"=="winxp" goto:eof if "Floatos"=="winvista" goto:eof Rem copying the files locally mkdir %target% copy %source%\%preinstall% %target% /Y cd %target% Rem Pre-Install can now go and run Start /wait C:\windows\system32\msiexec.exe -i %preinstall% /qn If "%above7%"=="True" ( If "%floatbit%"=="64" ( goto:install64-win8 )) If "%above7%"=="True" ( If "%floatbit%"=="32" ( goto:install32-win8 )) If "%above7%"=="False" ( If "%floatbit%"=="64" ( goto:install64-win7 )) If "%above7%"=="False" ( If "%floatbit%"=="32" ( goto:install32-win7 )) goto:eof :Install64-Win7 rem 64 BIT 7 copy %source%\%x64install% %target% /Y Start /wait C:\windows\system32\msiexec.exe -i %x64install% ADDLOCAL=Client,CredentialProvider,BaseEncryption,SectorBasedEncryption,SecureDataExchange,FileShare,CloudStorage OPALMODDE=2 /L* c:\sgnclient_%computername%.txt /qn /norestart copy %source%\%hotfix% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Hotfix1901x64.msp" /qn /norestart copy %source%\%x64patch% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Build28.msp" /qn /norestart echo Win7x64 goto:register :Install64-Win8 rem 64 WIN 8+ copy %source%\%x64install% %target% /Y Start /wait C:\windows\system32\msiexec.exe -i %x64install% ADDLOCAL=Client,CredentialProvider,BitLockerSupport,SecureDataExchange,FileShare,CloudStorage /L* c:\sgnclient_%computername%.txt /qn /norestart copy %source%\%hotfix% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Hotfix1901x64.msp" /qn /norestart copy %source%\%x64patch% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Build28.msp" /qn /norestart echo win8x64 goto:register :Install32-Win7 rem 32 BIT 7 copy %source%\%x86install% %target%\%x86install% /Y Start /wait C:\windows\system32\msiexec.exe -i %x86install% PATCH=%x86patch% ADDLOCAL=Client,CredentialProvider,BaseEncryption,SectorBasedEncryption,SecureDataExchange,FileShare,CloudStorage OPALMODDE=2 /L* c:\sgnclient_%computername%.txt /qn /norestart copy %source%\%hotfix% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Hotfix1901x64.msp" /qn /norestart copy %source%\%x64patch% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Build28x86.msp" /qn /norestart echo win7x86 goto:register :install32-win8 rem 32 WIN 8+ copy %source%\%x86install% %target% /Y Start /wait C:\windows\system32\msiexec.exe -i %x86install% ADDLOCAL=Client,CredentialProvider,BitLockerSupport,SecureDataExchange,FileShare,CloudStorage /L* c:\sgnclient_%computername%.txt /qn /norestart copy %source%\%hotfix% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Hotfix1901x64.msp" /qn /norestart copy %source%\%x64patch% %target% /Y Start /wait C:\windows\system32\msiexec.exe /update "%target%\Build28x86.msp" /qn /norestart echo win8x86 goto:register :Register copy %source%\%configinstall% %target% /Y Start /wait C:\windows\system32\msiexec.exe -i %configinstall% /qn /norestart Rem Delete local Sophos folder Rem RD /S /Q C:\Sophos Rem Restart computer shutdown.exe /r /t 00 :eof endlocal