Chris Rasmussen · Photographer · Infrastructure Guy · Code Dabbler · Traveller

Follow up – How to perform an unattended installation of the .NET Framework 2.0

Some time ago I wrote an article about how to do an unattended install of the .NET Framework 2.0. A visitor asked the following question about doing this in a login script:

If I add this to our login script, how do I make sure this does not try to install each time the person logs back in? Or is the install smart enough to detect that it is already installled?

Here’s a way of doing it. Note that this sample assumes you’re writing a standard/legacy .BAT/.CMD login script.

if not exist %windir%\Microsoft.NET\Framework\v2.0.50727 goto NotInstalled
goto Installed
:NotInstalled
echo Not installed!
echo Going to end …
goto End
:Installed
echo Installed
echo Going to end …
goto End
:End
echo Finished!

If you’re using .VBS or .KIX login scripts you’d obviously want to use your chosen script’s method of checking that file location. A couple of things to note:

- 2.0.50727 is the latest version of .NET 2.0 as of the date of this post.
- .NET 3.5 SP1 rolls up .NET 2.0 and all its features so you could just install that instead (it doesn’t include support for .NET 1.1 though).
- You could also check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework or HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\Policy … there are keys that that relate to the installed state of the various .NET framework versions.

In the :NotInstalled section of the script sample above you’d run the unattended installation of the framework.

Leave a Reply

Powered by Wordpress | Designed by Elegant Themes