DotNet4 One-off install script (network deployment)

We needed to deploy .Net4 to all desktops and laptops within the domain in order to be able to use the new version of our in-house developed service desk system, the most critical application in our business outside of Email.

So I found/ modified this script below and added it to group policy as a computer startup script, it worked a treat internally but those on VPN only needed to run the script manually, so I ended up sending it out to everyone anyway!

setlocal

REM *********************************************************************
REM Environment customization begins here. Modify variables below.
REM *********************************************************************

REM Enter the Product Name.
set ProductName= Microsoft .NET Framework 4 Extended

REM Set DeployServer to a network-accessible location containing the Office source files.
set DeployServer=\\dc1\netlogon\

REM Set LogLocation to a central directory to collect log files.
set LogLocation=”C:\Windows\Logs”

REM *********************************************************************
REM Deployment code begins here. Do not modify anything below this line.
REM *********************************************************************

IF NOT “%ProgramFiles(x86)%”==”” (goto ARP64) else (goto ARP86)

REM Operating system is X64. Check for 32 bit Office in emulated Wow6432 uninstall key
:ARP64
reg query “HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432NODE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%”
if NOT %errorlevel%==1 (goto End)

REM Check for 32 and 64 bit versions of Office 2010 in regular uninstall key.(Office 64bit would also appear here on a 64bit OS)
:ARP86
reg query “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\%ProductName%”
if %errorlevel%==1 (goto DeployOffice) else (goto End)

REM If 1 returned, the product was not found. Run setup here.
:DeployOffice
start /wait %DeployServer%\dotNetFx40_Full_x86_x64.exe /quiet /norestart
echo %date% %time% Setup ended with error code %errorlevel%. >> %LogLocation%\%computername%.txt

REM If 0 or other was returned, the product was found or another error occurred. Do nothing.
:End

Endlocal

Some Updates

A nice stable week in the office, spent some time over previous weeks developing install scripts for our in-house developed service desk application. Needless to say we had some minor deployment issues (mostly where people hadn’t taken the .Net4 update I sent out) – But overall most people we sorted by the end of the week, more important than ever this week due to time sheet submissions before the long Jubilee Bank Holiday here in the UK!

The new Fibre line, Firewall and VPN are working a treat so far, not too many connectivity problems, have been able to download at 50Mb/sec and still enable people to do their work properly! –

I’ve also been working on some database config things with a colleague, cant say I understand much of it yet but I am now proficient in installing and reinstalling SQL 2008 (and R2)!

Successful week on the build front, 3 physical servers, 2 virtual servers, 1 laptop – not bad for a relatively quiet week in the office.