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:


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 –

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.

Comments (26)

  1. Ben Hunter says:

    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 SystemsWindows 8Sourcessxs



  2. Ben Hunter says:

    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 :).


  3. 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 🙂


  4. Ben Hunter says:

    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.


  5. Ben Hunter says:

    Hi Abir,

    You must use MDT 2013 and the 8.1 ADK –…/details.aspx.



  6. Ben Hunter says:

    Hi Michael,

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



  7. Anonymous says:

    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??

  8. Anonymous says:

    Unfortunately, my method using DISM in an application deployed by SCCM 2012 R2 doesn't work and I don't find the reason why. For new OSD it's no problem, but what's about the case of deploying netFX to existing Windows installations? At the moment, the
    only solution would be redeploy complete Windows installation. By the way: Using Powershell is also not working.

    Is it fact, that netFX is only installable via task sequence?

    @Barbara You don't need to use the complete sources folder – it's enough to use sourcessxs which is only 300 mb.

  9. Mathieu says:

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

  10. Mathieu says:

    Nevermind, not enough coffee I guess,

  11. Thanks for the correction  🙂

    / Johan

  12. Michael G says:

    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.

  13. John Gilham - Ago;e OT says:

    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 SystemsYourWindows8 FolderNameInMDTSourcesSXS" /LimitAccess

  14. Jeff Dunlap says:

    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.


  15. la_bruin says:

    Hi, I got an unknown error during deployment via Media when I use WindowsSource=%DeployRoot%Operating SystemsWindows 2012Sourcessxs

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

  16. abir says:

    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?

  17. khasru says:

    C:>DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:E


    Deployment Image Servicing and Management tool

    Version: 6.2.9200.16384

    Image Version: 6.2.9200.16384

    Enabling feature(s)

    [===========================65.8%======                    ]

    I have run the above command to install Netframe 3.5 as follows, but I am unable to finish installing Netframe 3.5 with following error Message.  E: is my Windows 8 Enterprise Edition DVD drive. I have installed Windows 8 Enterprise Edition X64 in my PC successfully and it is running very smoothly so far.


    Error: 0x800f081f

    The source files could not be found.

    Use the "Source" option to specify the location of the files that are required t

    o restore the feature. For more information on specifying a source location, see

    The DISM log file can be found at C:WindowsLogsDISMdism.log


  18. Ben Hunter says:

    Hi Khasru,

    I have seen the same issue before and it seems to be related to how the Windows 8 ISO is mounted. When I have mounted the Windows 8 ISO within the OS itself by simply clicking on the ISO I have this error. However when I mounted the ISO within a Virtual machine and extracted the SXS folder it worked. I am not sure why this is but it did solve the problem for me.



  19. Daniel says:

    Can you just create a task sequence that sets the source for you? We have a very basic setup – and do not have heavy customsettings.ini since they encompass all tasks. We have a windows 8, and 8.1 install and like to segregate those from one another, and felt that adding a specific task sequence would do this.


    Add->General->task sequence variable:

    Name: whatever

    Task Sequence Variable: WindowsSource
    Value: %deployroot%Operating Systems*version of OS*sourcessxs

  20. Vlad Stemate says:

    Hi Ben, I've been using the WindowsSource variable for 2012 server, but 2012 R2 needs a new sxs folder, can you add mutiple lines of this so during the install it searches and chooses the appropriate one?


  21. Vlad Stemate says:

    Well, I managed to find the solution myself, what I did is merge the contents of the sxs folders on 2012 R2 with the ones of the regular 2012 in the folder defined in WindowsSource and now it works like a charm, I guess is logical that each OS knows to pick its own files.

  22. Rasmus Melander says:

    Something I noticed was when you include a language pack(packages) you need to merge the original sourcessxs files with the ones in

  23. Karl Kindseth says:

    I need to run the DISM remotely and would rather not copy the entire contents of the sxs folder to our server. Does anyone know what specific folder in the sxs folder is being used or is it multiple folders?

  24. Simon L. says:

    I think that there's another nice method to activate .Net Framework 3.5 on Windows 8.1 by using SCCM.

    With Powershell I was able to run DISM.exe /English /NoRestart /Online /Enable-Feature /FeatureName:NetFx3 /Source:".sxs" successfully (of course I moved to the sources folder on the mounted Windows image before) while I wasn't connected to the internet. I
    think an application in SCCM should also work – I will Keep you informed about my test results.

  25. Barbara says:

    We just setup system center 2012r2 and are doing OSD deployments of the OS. I fought with .net 3.5 for hours and still could not get it to work as part of the task sequence. I was taking a break from it to get new perspective and ideas, so I ended up removing
    it as a prerequisite and installing the application anyway (we are still testing images). Then we run the DISM command once it gets to windows. The windows 8.1 enterprise media (ISO mounted to the hyper-v) had one CAB file in that source folder, not all of
    the rest of the files that should be there. The real source directory is Gigs. Anyway it could be narrowed down to only the files it needs for the .net 3.5?

  26. Mateo says:

    SimonL1986, I have been fighting with exactly same problem.
    Anybody can help out with deploying .net to existing win 8.1 machines please?