Install .NET Framework 3.5 SP1 using PowerShell

Installing .NET Framework 3.5 SP1 on Windows Server 2012 R2 should be easier. Unlike normal role and feature additions the binaries are not installed during Windows installation. This is fine if your server can access the Internet, but if it can’t then the installation media is required. Installation media these days are ISO files, so why not make your life easy and mount it on the server? Thankfully Windows finally has the ability to do this natively without the use of a third party tool (my favourite is still SlySoft Virtual CloneDrive).

So, using the GUI one can follow Enable .NET Framework 3.5 by using the Add Roles and Features Wizard. That’s no fun though, so I found Enable .NET Framework 3.5 by using Windows PowerShell. It’s not quite there though, I’d like some more automation.

Here’s how I install .NET Framework 3.5 SP1 using PowerShell. It will mount the media, install the feature and then unmount the media without you doing anything.

Modify the $ISO variable as required to the location of your media:

#Specify the local path path or network share URI to the Windows Server 2012 R2 media
$ISO = "\\FILESERVER\Microsoft\Win2012\SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_-4_MLF_X19-82891.ISO"

#Mount the ISO to an available drive letter
#https://technet.microsoft.com/en-us/library/hh848706.aspx
$imagehdl = Mount-DiskImage -ImagePath $ISO -Verbose -Passthru

#Find the drive letter that was assigned
#https://technet.microsoft.com/en-us/library/hh848646.aspx
$mntpoint = ($imagehdl | Get-Volume).DriveLetter

#Install .NET Framework 3.5 SP1
Import-Module ServerManager
#https://technet.microsoft.com/en-us/library/jj205467.aspx
Install-WindowsFeature Net-Framework-Core -Source "$($mntpoint):\sources\sxs"

Get-WindowsFeature -name NET-Framework-Core | Select Name,Installed

#Dismount the ISO, we're done
#https://technet.microsoft.com/en-us/library/hh848693.aspx
Dismount-DiskImage -InputObject $imagehdl

One thought on “Install .NET Framework 3.5 SP1 using PowerShell

  1. Hello.. You can find an original activation key for Windows Server 2012 on the website licence-activation.com

Leave a Reply

Your email address will not be published. Required fields are marked *


*