Saturday, July 4, 2020

PowerShell: Installing .NET 3.5 on a stock Azure VM running Windows Server 2012 R2

To handle a pressing issue I needed to setup an environment running the following on an Azure VM.
  • Windows Server 2012 R2
  • SQL Server 2014
  • SharePoint Server 2013 R2
The Windows Server 2012 R2 image provided by Azure's VM marketplace did not come with .NET Framework 3.5 installed. SQL Server 2014 and SharePoint Server 2013 R2 both require .NET Framework 3.5.

Using Server Manager on the Windows Server 2012 R2 host to install .NET Framework 3.5 results in the following error after the Install button pushed on the final configuration screen:


Microsoft provides the following article, Enable .NET Framework 3.5 by using Windows PowerShell, explaining how to install .NET Framework 3.5 on Windows Server 2012 R2. 

The first step required to install the .NET Framework 3.5  is to download a Windows Server 2012 R2 installation image. The image contains a folder Source\SXS which has the files required to install .NET Framework 3.5. Those with access to a Visual Studio Enterprise Subscription can login to the following URL and select the Downloads menu:

After the Downloads menu is selected, enter Windows Server 2012 R2 in the search box. Clicking on the Search button will reveal the requisite download:


Once the ISO (DVD image) is downloaded, click on the file in Windows Explorer which mounts the image on operating systems like Windows 10. On my machine the ISO for Windows Server 2012 mounted as the E: drive. On the mounted drive navigate to sources\sxs


Make a zip file of the Sxs folder (Sxs.zip) and copy the zip file to the Windows Server 2012 R2 host requiring .NET Framework 3.5. Unzip the file on the Windows Server 2012 R2 host (see C:\Source\Sxs below):


On the Windows Server 2012 R2 run PowerShell as an administrator and from the PowerShell console invoke the Install-WindowsFeature cmdlet as follows:

Install-WindowsFeature Net-Framework-Core -source C:\share\sxs

As is show below by the Add Roles and Features Wizard, .NET Framework 3.5 is now installed:


Appendix A: Installing .NET Framework 3.5 with Server Manager (ending in failure)

The traditional way to install a feature such as .NET Framework 3.5 is by running Server Manager and selecting Add roles and features. This section attempts to demonstrate installing .NET Framework 3.5 in this fashion but ultimately the installation will end in failure. 

The steps to unsuccessfully install .NET Framework 3.5 on Windows Server 2012 R2 are as follows. 

Run Server Manager: 


From Dashboard select Add roles and features which starts the Add Roles and Features Wizard:


Click Next:


By default the radio button Role-based or feature-based installation is checked. Leave this radio button checked and click on Next:


By default the current server will be selected and the radio button Select a server from the the server pool will be checked. Leave the default settings and click the Next button:


Click the Next button:


Click on the checkbox labeled .NET Framework (includes .NET 2.0 and 3.0). This action will active the Next button as follows:


Click on Next:


The failure message provides the clue as to how to install .NET 3.5. The full text of this failure message is: Do you need to specify an alternate source path? One or more installation selections are missing source files on the destination server. The server will try to get missing source files from Windows Update, or from a location that is specified by Group Policy. You can also click the “Specify an alternate source path” link on this page to provide a valid location for the source files.



















No comments :

Post a Comment