If a customer is finding that the install fails occasionally when installing via script it migght be useful to create a script which tries installation again upon failure.


I've written a script like this and attached it here. All it does is delay the initial install which also helps with failed install issues, then if the install fails, it will wait a random ammount of time and try again (up to 60 seconds), it does it 3 times so it doesn't keep looping 


NOTE: please remember to replace the msiexec install command with your own. it doesn't have to be a tranform file one, it can be a standard install script too.


@echo off
set RETRY_COUNT=0
set MAX_RETRIES=3
set RETRY_DELAY=10

:retry_install
rem Generate a random delay between 20 and 70 seconds
set /a random_wait_time=%RANDOM% %% 51 + 20
echo Waiting %random_wait_time% seconds before installation attempt...
timeout /t %random_wait_time% /nobreak

msiexec /i \\ndlsvrfs\censornet\Setup64.msi TRANSFORMS=\\ndlsvrfs\censornet\Censornet64.mst /quiet /l*v uss_install.log

if %errorlevel% neq 0 (
    set /a RETRY_COUNT+=1
    echo Install failed with error code %errorlevel%. Attempt %RETRY_COUNT% of %MAX_RETRIES%.
    
    if %RETRY_COUNT% lss %MAX_RETRIES% (
        rem Generate a new random delay for the next retry
        set /a random_wait_time=%RANDOM% %% 51 + 20
        echo Waiting %random_wait_time% seconds before retrying...
        timeout /t %random_wait_time% /nobreak
        goto retry_install
    ) else (
        echo Installation failed after %MAX_RETRIES% attempts.
        exit /b %errorlevel%
    )
) else (
    echo Installation completed successfully.
)