Sharing my setup for updating Spark silently in Windows AD environment. As there is no msi package for Spark, usual software deployment tools do not work. So, i have Spark's installation on the share, e.g. \\server\spark\. It contains:
spark_2_8_0_885.exe (final build of 2.8.0 version, though it can be named whatever you like, i just like to have build number attached as i often install intermittent builds, not just final versions; my installer also includes java, but you can install the online version the same way)
spark_2_8_0_885.txt (empty txt file, which should be named exactly the same as the exe above; it is used to check for a version currently installed, so a script won't install new version over and over again)
Then i have a GPO in my AD, which is attached to OU with computers. In the Computer Configuration > Policies > Windows Settings > Scripts (Startup/Shutdown) > Shutdown i have two scripts (for x86 and x64 machines). Contents of scripx86.cmd:
IF EXIST "C:\Program Files\Spark\spark_2_8_0_885.txt" GOTO END
IF EXIST "C:\Program Files (x86)\Spark\spark_2_8_0_885.txt" GOTO END
taskkill /F /IM Spark.exe
\\server\spark\spark_2_8_0_885.exe -q
del "C:\Program Files\Spark\*.txt"
copy \\server\spark\spark_2_8_0_885.txt "C:\Program Files\Spark\"
:END
This scripts checks for the txt file mentioned above. If it exists, then nothing happens. It also checks the x86 folder on x64 machine. Seconds script is the same, only the last like copies txt file to C:\Program Files (x86)\Spark\ folder. Having those two scripts means that first script might install Spark on x64 machine, but won't be able to copy new txt file to the appropriate folder. So the second script will do the copying or maybe also install the Spark itself. It is possible that on x64 machine Spark will be installed twice, but that's not a problem in my book There are probably more elegant ways to achieve that, but this works for me (we only have a few x64 machines). These scripts run when PC is shutting down. It tries to kill Spark process, if system hasn't yet done that and then runs installer with the silent key "-q". Most of the time installation works fine. But because of network issues or abnormal shutdowns ~2% of machines do not upgrade normally and need manual intervention. When new version comes out, i put the installer into \\server\spark, rename the txt file, then change version in both scripts.