Microsoft Silverlight patching script
Here’s a handy little M$ $ilverlight updater script you can use. I had a few clients on version 4, then one got prompted for a site they use to “Install Silverlight”. If they didn’t they couldn’t use the site, odd thing was they already had it installed! Apparently, the real problem is they wanted a more current version. Understandable I guess. Here’s a system startup script you can apply via Group Policy to machines as they startup. If it doesn’t find version 5 then it installs it, if it does find version 5 it ends.
I won’t explain too much, I assume you can modify the network paths to your environment and don’t need much hand holding :P
Download link for Silverlight version 5 <– There
Remember too you need the “filever.exe” file to check file versions via the command line. Search my site or the InternetS for the download.
Put the below in a batch file (filename.bat).
@echo off
:: SilverLight v5 installer
:: Note that a value of 0 = true, value of 1 = false
echo Checking to see if you have Silverlight installed…
if exist “%ProgramFiles(x86)%\Microsoft Silverlight” goto filever
if exist “%ProgramFiles%\Microsoft Silverlight” goto filever
goto end
:filever
:: V5 checker
“\\yourserver\yourshare\filever.exe” “%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”5.”
“\\yourserver\yourshare\filever.exe” “%ProgramFiles%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”5.”
echo Error value is %errorlevel%
if %errorlevel% EQU 0 goto end
:: x86
“\\yourserver\yourshare\filever.exe” “%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”4.0″
echo Error value is %errorlevel%
if %errorlevel% EQU 0 goto end
echo Upgrading Silverlight…
\\yourserver\yourshare\silverlight /q
goto end
“\\yourserver\yourshare\filever.exe” “%ProgramFiles(x86)%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”4.1″
echo Error value is %errorlevel%
if %errorlevel% EQU 0 goto end
echo Upgrading Silverlight…
\\yourserver\yourshare\silverlight /q
goto end
:: x64
“\\yourserver\yourshare\filever.exe” “%ProgramFiles%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”4.0″
echo Error value is %errorlevel%
if %errorlevel% EQU 0 goto end
echo Upgrading Silverlight…
\\yourserver\yourshare\silverlight /q
goto end
“\\yourserver\yourshare\filever.exe” “%ProgramFiles%\Microsoft Silverlight\sllauncher.exe” | findstr /C:”4.1″
echo Error value is %errorlevel%
if %errorlevel% EQU 0 goto end
echo Upgrading Silverlight…
\\yourserver\yourshare\silverlight /q
goto end
:end
echo The glass is either half empty
echo or half full :P
Note that the “silverlight.exe /q” is a quite install, the “/qu” switch is a “quiet uninstall” so technically to be cleaner you’d want to “uninstall” your old version then install the new version but it’s only SilverLight so who cares? :P For a slicker script you could also do a mashup of another script I have that detects architecture which would then negate the need to check both the Program Files AND Program Files (x86) folders but I didn’t do it like that because I tweaked an existing script and didn’t want or need to reinvent the wheel.
“Technically” you probably do want to do the quiet uninstall of the old version just to keep consistency and to keep a tidy group of hosts but…it’s a free world…I think.
Ideally, to be completely strict you’d detect architecture (32 bit or 64 bit), then check version, then uninstall if necessary, then call your installer for the latest version.