Install .NET Framework 3.5 feature on Windows Server 2012 R2

20170522110941The .NET Framework 3.5 feature is not installed by default on Windows Server 2012 R2 as this version of Windows ships with .NET Framework 4.5 already installed. If you want to install .NET Framework 3.5 then it needs to be manually installed. SQL Server 2012 requires the .NET Framework 3.5 feature to be installed, if it isn’t you will see this error when attemtping to install it:

20170522095650

Installing the .NET Framework 3.5 feature

Please note that you require the Windows Server 2012 media in order to install the .NET Framework 3.5 feature. It must be mounted to a Windows drive, in my case I mounted it to the D:\ drive:

20170523163134

 

 

1. Click on the Server Manager icon in the bottom left-hand corner to load the Server Manager Dashboard:

20141101005404

2. When the Server Manager Dashboard loads, click on Add roles and features in the center pane as highlighted below:

20170520095702

The Add Roles and Features Wizard will load, click Next to go past the initial Before You Begin Page:

20170520095832

3. In the Installation Type section, select Role-based or feature-based installation and click Next:

20170520095906

4. In the Server Selection section, select your server, in my example below, my server is called vs11app001, then click Next to proceed:

20170520100125

5. In the Server Roles section, do not select anything, click Next:

20170520100150

6. In the Features section, select .NET Framework 3.5 Features then click Install to proceed:

20170520100346

7. In the Confirm installation selections section, click on Specify an alternate source path:

20170520100622

8. Then in the Specify an alternate source path section, change the Path to reflect the location of your Windows 2012 media:

20170520100938

Ensure you enter the full path to the SxS folder, in my case the media was on the D:\ drive, so the full path was D:\Sources\SxS.

9. Click OK to go back to the Specify an alternate source path section and then click on Install to proceed with  the installation:

20170520101051

10. You can click close at this stage and the installation will complete soon after.

Please note that you can install .NET Framework 3.5 via the command line using the Deployment Image Servicing and Management (DISM) tool and running:

Dism /online /enable-feature /featurename:NetFX3 /All /Source:S:\Sources\SxS /LimitAccess

Irrespective of the installation method you choose, a reboot is not necessary but I would recommend it to ensure the changes are committed to the system and that it starts up cleanly.

11. Verify that .NET Framework 3.5 has been installed successfully by navigating to C:\Windows\Microsoft.NET\Framework64. You will see folders representing the installed .NET Framework versions:

20170520102304

As you can see versions 2.0, 3.0 and 3.5 were installed by our actions above, version 4.0 was already present.

As an aside, you can run the PowerShell code below, which I found here, to  confirm the installed .NET Framework versions also:

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release

Running this script yields the following results:

20170522094711

You can now proceed with installing SQL Server 2012 or any other activity that required you to install .NET Framework 3.5.

References:
PowerShell script to return versions of .NET Framework on a machine?
Installing .NET framework 3.5 on windows server 2012

Format NTFS disk with allocation unit size of 64K via PowerShell

20160614150939In a previous post I showed you how to get the allocation unit size of a Windows disk. In this post I will show you how to set it using PowerShell.

To set the allocation unit size in the GUI, follow the normal steps to format a drive and in the Format Partition box select 64K in the Allocation unit size drop-down per the below:

20160829170230

Provide a Volume Label if desired, then click Next and Finish, after which your drive will be formatted with NTFS with an allocation unit size of 64K.

To do this in PowerShell, run the script below:

$Disk = Get-Disk -Number 1
Set-Disk -InputObject $Disk -IsOffline $false
Initialize-Disk -InputObject $Disk
New-Partition $Disk.Number -UseMaximumSize -DriveLetter E
Format-Volume -DriveLetter E -FileSystem NTFS -AllocationUnitSize 65536 -NewFileSystemLabel DATAFILES -Confirm:$false

The script above will get Disk 1 in Disk Management and initialize it, bring it online, assign it letter E, format it with NTFS and an allocation unit size of 64K and assign it the label DATAFILES.

I found a great script here for performing the same task as above.

References:
Format-Volume
PowerShell Script to Configure SQL Server Storage