Windows 8: Automating the installation of .NET Framework 3.5 with MDT

 

[Correction – November 14th 2012]

I have been informed that the new built in roles and features functionality of MDT 2012 Update 1  has the following very useful functionality.

  1. It will automatically try to find the SXS folder in the deployment share that you are using to deploy the image.
  2. You can specify the a variable in the Customsettings.ini file that points to an alternative location for the SXS folder, here is an example:

      WindowsSource=%DeployRoot%\Operating Systems\Windows 8\Sources\sxs

This is a nice and simple approach to installing the .Net Framework 3.5. I have left the blog post below in case you need to install is in a scripted manner.

[End of Correction]

 

When creating a Windows 8 master image one of the few applications that I include in the image is .NET Framework 3.5.

To automate the installation you must run the following DISM command and specify the source file location:

DISM.exe /online /enable-feature /featurename:NetFX3 /All /Source:"D:\Sources\SXS" /LimitAccess

The key to getting this to work is to specify the “Source” path correctly, this must point to the SXS folder from the Windows 8 Media.  With this process in mind I have created a PowerShell script that uses two methods to install .NET Framework 3.5:

  1. Use Source files from the Windows 8 media that you are using to install the OS itself.
  2. Use a copy of the SXS folder - If we cannot find the source files there then we look for them subfolder (called source) of the folder that the script is located in and install from there.

The first method is very simple, the script simply looks for the OS source files that are being used to install Windows 8 and uses the SXS folder included with this media. However, this approach does not work well when we are deploying a custom image and this folder is not available. In this case we use the second method.

To make the second method work you must copy all of files in the SXS folder on the Windows 8 media to a folder called source that is located in the application folder, this folder will then be referenced directly during installation. Here is an example of the folder structure:

 image

I have created an MDT application for this script which you can download from here.

To import this application to your deployment share and add it to your task sequence do the following:

1. Download and Extract the Zip file to a temporary folder

2. Locate the SXS folder on your Windows 8 media and copy the contents to the INSTALL – NET Framework 3.5\Source folder that you extracted to the temporary folder.

3. Import the application into the MDT Deployment Workbench using Create Application with Source Files, with the following options:

    Application Name:   INSTALL – NET Framework 3.5 

    Source Directory:     <Temp Folder>\INSTALL – NET Framework 3.5

    Command Line:        Leave this field empty

4. Open the task sequence that you want to use to install .NET Framework 3.5 and navigate to the State Restore Phase.

5. Add a PowerShell task sequence action to the task sequence by navigating to Add>General>Run PowerShell Script, use the following settings:

    Name:                    INSTALL – NET Framework 3.5 

    Command Line:    %DEPLOYROOT%\Applications\INSTALL - NET Framework 3.5\INSTALL_NET35Framework.ps1

6. Click OK to close the task sequence editor.

You may have noticed that I am using the Run PowerShell Script task sequence action directly rather than calling the PowerShell from the application command line. This is because the task sequence action allows me to leverage the MDT logging and access to MDT variables. For more information on this please see Michael Niehaus’ blog - http://blogs.technet.com/b/mniehaus/archive/2012/07/23/mdt-2012-update-1-powershell-3-0-support.aspx

This post was contributed by Ben Hunter, a Solution Architect with Microsoft Consulting Services.

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .