REM Main Function
REM Detect system architecture and set appropriate XML file
set ARCH=%PROCESSOR_ARCHITECTURE%
if defined PROCESSOR_ARCHITEW6432 set ARCH=%PROCESSOR_ARCHITEW6432%

if /I "%ARCH%"=="ARM64" (
    set SourceXml=DefaultOnlookerDetection_arm64.xml
) else if /I "%ARCH%"=="AMD64" (
    set SourceXml=DefaultOnlookerDetection_amd64.xml
) else (
    @echo %date% %time% Unknown architecture: %ARCH% >>c:\swwork\modules.log
    goto :Error
)

@echo %date% %time% Using %SourceXml% for architecture %ARCH% >>c:\swwork\modules.log
c:\swwork\xmodify.exe /m /s%~dp0%SourceXml% /tC:\Windows\Panther\unattend\unattend.xml
if %errorlevel% equ 0 goto :End

:Error
@echo %date% %time% Error Error Error Error Error Error >>c:\swwork\modules.log
@echo %date% %time% SetDefaultOnlookerDetection failed. >>c:\swwork\modules.log
@echo %date% %time% Error Error Error Error Error Error >>c:\swwork\modules.log

:End
