Content

This is the introduction

Welcome back to another blog post and today I will cover how to deploy .Dot 3.5 from Intune.

There could be many reason for why we want to deploy any version of .Net to our Windows devices but the most frequent one I encounter is that there’s still a lot of applications requiring version 3.5 and Windows 10 does not come with that pre-installed.

Togehter with the new feature in Intune to set dependencies on Win32 apps we are now able to

deploy .Net as a dependency so we no longer have to include .Net in all of our applications that requires it.

Prereqs

To make this all happen we have few things, first of all .Net 3.5 then we need a custom Installation script which is provided below and then we need to convert it to a .Intunewim file.

.Net 3.5

We have 2 ways of getting the .Net 3.5 content to the client In this scenario. We will be using the Enable-WindowsOptionalFeature powershell cmdlet and we can either specify a source path for the .cab files. Instead of adding the source files to the installation package we can also just let each machine get the content directly from Microsoft.





If you have a Win10 ISO you can get the .NET 3.5 cab-files from the SXS folder. Mount the Win10 ISO and navigate to sources\sxs and copy the 2 files that contains netfx3 in the name.

You could also download the .Net 3.5 from Microsoft and that will get you the .EXE installer. But in this post I wont cover installing the .EXE mainly because I have had mixed result using the .EXE.

https://www.microsoft.com/en-us/download/details.aspx?id=25150

Microsoft Win32 Content Prep Tool

the Win32 content prep tool is needed to create our .Intunewim file that we will upload to Intune later.

Start with heading over to github and download the tool

To download the Win32 content prep tool head over to https://github.com/Microsoft/Microsoft-Win32-Content-Prep-Tool

Creating our application and deployment

The next step is to start putting it all togheter.

Creating our Installation script

Here’s the powershell Installation script we will use, this will invoke the installation or uninstall depending on what we parameter we call the script. This will make us be able to both do Install and uninstall with Intune.

Im also including logic In the script to check if the .Net content already exist in the Win32 app package, if the folder sxs exist and inside at least one NetFx3 cab-file is present it will run the DISM command and point to that source. If the files and folder does’t exist it will run Enable-WindowsOptionalFeature withouth the /source parameter which means that the computer will go to Windows update and get the files needed.

More info about DISM here https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/deployment-image-servicing-and-management–dism–command-line-options

Param( [Parameter(Mandatory=$true)] [ValidateSet("Install", "Uninstall")] [String[]] $Mode ) If ($Mode -eq "Install") { if (Test-path .\sxs\Microsoft-Windows-NetFx3-OnDemand-Package*.cab) { #Offline Installer Enable-WindowsOptionalFeature -Online -FeatureName 'NetFx3' -Source .\sxs\ -NoRestart -LimitAccess } else { #Online installer Enable-WindowsOptionalFeature -Online -FeatureName 'NetFx3' -NoRestart } } If ($Mode -eq "Uninstall") { Disable-WindowsOptionalFeature -Online -FeatureName 'NetFx3' -Remove -NoRestart }

Creating our .wintunewim file

Create a new folder called dotnet35 and copy in the script Install.ps1 and also include the SXS folder with the .Net 3.5 cab-files if you want to use local source installation and be able to take advantage of Delivery Optimization otherwise

skip the SXS folder.

Run the IntuneWinAppUtil.exe from the Microsoft Win32 Content Prep Tool that you downloaded earlier, follow the instructions and create the .Intunewim file

Deploy our application with Intune

If you havent deployed a Win32 app before in Intune I recommend you check out the documentation from Microsoft here https://docs.microsoft.com/en-us/intune/apps-win32-app-management

I won’t go through all the steps in detail in this post on how to create a Win32 app but instead I’ll just go through the most important parts of Install / Uninstall and detection method.

The installation and uninstall command we will be using looks like this

powershell.exe -ExecutionPolicy Bypass -file Install.ps1 -Mode Install

powershell.exe -ExecutionPolicy Bypass -file Install.ps1 -Mode Uninstall

And for detection method I’m just looking for a registry key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v3.0

We have now created our Win32 app and can set other Win32 apps having .Net 3.5 as a dependency or assign it directly to any user or device we want.

On the client side, if we have toast notification turned on for the deployment we will see that the Win32 app get installed.

Leave a comment or question in the comment section below.

That’s all for now and until next time, cheers !

And you can also find me blogging over at http://blog.ctglobalservices.com/