The Deployment Guys

Helping to deploy your world automagically...

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

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

  • Comments 21
  • Likes

 

[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.

  • Thank you for the post but you probably forgot the script.

  • Nevermind, not enough coffee I guess,

  • The MDT "Install Roles and Features" step will automatically do this when you install from full source files.  You should know that :-)

    When you aren't using full source files, you'll need to set the WindowsSource task sequence variable to point to a location containing the SXS files.  Once you do that, "Install Roles and Features" will take care of the rest.  You should know that too :-)

    -Michael

  • Thanks for the correction  :)

    / Johan

  • I'm installing Server 2012 Standard from MDT2012 Update1 with full source files and it doesn't work.  The install of .Net 3.5 errors out.

  • There is a simpler solution that does not require any copying or creation of an application.  For us, we created a standard Windows 8 Task sequence, and added:

    Add > General > Run Command Line > Named "Install .Net 3.5" (for me, in the State Restore stage before the first Windows Update)

    DISM.exe /online /enable-feature /featurename:NetFX3 /All /Source:"%deployroot%\Operating Systems\YourWindows8 FolderNameInMDT\Sources\SXS" /LimitAccess

  • Hi John,

    Thanks for the information, this is the easy approach that I outline above as point 1. I think that I should have also added how to do this as you have out lined :).

    Ben

  • Hi Michael,

    Do you have any details of the error that you are getting?

    Thanks,

    Ben

  • Great Post,

    How does this differ for SCCM 2012 SP1 Task Sequences? We have SCCM2012 SP1 with MDT 2012 integration and I'm attemping to install .Net 3.5 via the Install Roles and Features task on a Windows 8 system. I'm seeing the error "The source files could not be downloaded. Use the source option to specify the location of the files required to restore this feature". Given that this is OSD and we are using an OS Source package, I can't just use the path to the operating system source folder like I could using MDT.

    Am I missing some kind of TS variable that needs to get set or does the built in just not work for things that are in the install source like .net 3.5.

    Thanks

  • Hi Jeff,

    I think the best approach when using ConfigMgr would be to create a standalone application to install .net framework as detailed in the blog above. This might be easier than using the Roles and Functions approach.

    /Ben

  • Hi, I got an unknown error during deployment via Media when I use WindowsSource=%DeployRoot%\Operating Systems\Windows 2012\Sources\sxs

    When  I check the ZTIOSRole.log file it says cannot find path  M:\deploy\operating systems\.... Where does the M: drive come from? And why doesn't this work?

  • hello,i cant use mdt on windows 8.i have mdt version 2012.when i click import button ,it says something about aik is not present on your system.please download version 6.07 or later.can u please give me the link of aik for windows 8?

  • Hi Abir,

    You must use MDT 2013 and the 8.1 ADK - www.microsoft.com/.../details.aspx.

    Thanks,

    Ben

  • Based on the ZTIORoles.wsf log, MDT skips seaching for the SXS folder when installing role on a system deployed with full Win 8 OS but when using and imaged OS, I see the step where it successfully locates the SXS folder before running the DISM command. Any ideas why??

  • Hi Rafique,

    MDT searches for the SXS folder if it is installing a role as part of an OS deployment, as you have observed. If it cannot find an SXS folder then you must specify the location.  If you not also installing the OS then the MDT task sequence assumes it does not have the appropriate source files available required, hence it skips looking for the folder. If you have these files on the deployment share then you can manually specify a WindowsSource folder, for example:

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

    Thanks,

    Ben

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment