Install .NET 4 via command line or PowerShell?

I have done the following in Powershell:

((new-object net.webclient).DownloadFile("http://download.microsoft.com/download/9/5/A/95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE/dotNetFx40_Full_x86_x64.exe","dotNetFx40_Full_x86_x64.exe")) 
& .\dotNetFx40_Full_x86_x64.exe /q

There are other command line options than /q (for quiet). You can see those by doing:

& .\dotNetFx40_Full_x86_x64.exe /?

MessageBox resulting from running installer with the /? switch


This isn't specific to powershell, but might be of help. After installing .NET3.5 we follow up using the full install binaries, simply running a silent install. Depending on what and how you install this may require a reboot.

This how I've run silent installs of .NET4 in build/update scripts on 2003-2008R2 servers using the full install package:

  • dotNetFx40_Full_x86_x64.exe /q

If you've not already stumbled across these, you might find them useful:

  • MSDN .NET Framework Deployment Guide for Developers
  • Aaron Stebner's WebLog-Silent install, repair and uninstall command lines for the .NET Framework 4