Deploy .Net Framework 3.5.1 as an App using Configuration Manager 2012 R2

Even thou .Net Framework 4 and even 4.5 have been released there are still alot of applications out there that require .Net Framework version 2.0, 3.0 and 3.5. For all of those applications we need to include .Net Framework 3.5.1 in our OS images that we distribute to our clients and servers.

When we are moving on to a world where we are using BYOD and other constellations of devices we can not always guarantee that .Net Framework 3.5.1 have been included, and in a real world an administrator could have installed .Net Framework after that the OS image was deployed. I’ve also been at customer sites where they haven’t included it in the OS image at all. For all of you, this is how I solved it using the Application Model introduced in System Center 2012 Configuration Manager, however it works perfectly fine in SCCM 2012 R2 as well!

The first thing we need to handle is how to actually deploy the feature into the OS and if does differentiate a little from each version.

net framework

As you can see, not all versions require content, and default for Windows Server 2008 is version 3.0. We can of course deploy 3.5.1 there as well but that is a different blog post.

net framework install and uninstall

Above you see the program string for both installation and uninstallation for Windows Server 2012. It is more or less the same for all operating systems since we use DISM.

We run the following command in order to install

DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:.\

And the following command in order to uninstall the feature

DISM /Online /Disable-Feature /FeatureName:NetFx3

Now, since we need to use ‘Script Installer’ Deployment Type in order to run DISM we can’t leverage the feature of the ‘New Deployment Type’ Wizard that automatically creates a Detection Method based on the MSI GUID (known as the Product UI or Product GUID).

Here comes the really tricky part. Hold on to your hat!

Instead of detecting a file’s presence or version we can create a VB-script that checks if a specific feature is installed or not.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set oss = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
for each os in oss
if Left(os.version,3) = "6.2" AND os.OperatingSystemSKU > 6  then
Set colItems = objWMIService.ExecQuery("Select * from Win32_ServerFeature WHERE ID=’220’")

If colItems.Count > 0 then
    wscript.echo "Passed!"
End If
End if
Next

 

Important to notice here is that you actually should verify that you only run the actual check (Select * from Win32_ServerFeature…) on an OS that support it. Even thou you use Requirements to check/limit the Deployment Type to a specific OS version the Detection Method script will run.

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set oss = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
for each os in oss
if Left(os.version,3) = "6.3" AND os.OperatingSystemSKU < 7  then
Set colItems = objWMIService.ExecQuery("Select * from Win32_OptionalFeature WHERE installstate=’1′ AND Name=’NetFx3’")

If colItems.Count > 0 then
    wscript.echo "Passed!"
End If
End if
Next

We see the problem when we look at the script for the client OS where Win32_ServerFeature isn’t availably but instead Win32_OptionalFeature is there.

detect-client

 

How should we troubleshoot or peak on whats happening on the client when we do this?

Well, we’ll start by looking at the log file to see that we could detect that the application currently isn’t present. This is since we are using the new Application Model that is ‘State Based’.

not detected

The three last rows in this log file, AppDiscovery, are the important ones. We can see that the application isn’t detected using a script detection type and on the last row, we can the that it actually ran the rule for Windows 8.1 as well as Windows Server 2008 R2 (middle of the picture). The system that this log file is from is a Windows Server 2012 (top of the picture).

If we choose to install .Net Framework using Software Center…

installing

…we can follow what happens first in the AppDiscrovery.log (so that it haven’t been installed since last detection)…

installing-log

…and then in the AppEnforce.log what it actually run in order to install .Net Framework.

enforce

Once we reach the line with “App enforcement completed” in the log the actual installation is done. We can now see that the application is discovered.

 

Lastly, I would like to point out that the content for Windows 8, 8.1, Server 2012 and Server 2012 R2 is the Source\SxS folder on the installation media.

 

/Tim

zv7qrnb

About The Author

Tim Nilimaa is a consultant with Lumagate in Sweden. He has been working with Configuration Manager for 8 years. His knowledge has been selected as a speaker at many events among them Microsoft Management Summit.

6 Comments

  1. Barry Platt says:

    Useful posting – thanks for that. The SCCM 2012 application model looks to be great for handling dependencies, but I keep running into issues detecting Microsoft runtimes as they don’t all fit the convenient MSI model.

    One thought though on the detection process – could you not instead check the registry for installed .NET framework versions? MSDN documents this here: http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx

    It seems that this should be a simpler test, and also avoids the need for platform specific WMI queries.

    Reply
    • Tim Nilimaa says:

      That is a great remark Barry, I will try to find time to update the blog post using those values instead once I’ve verified that it works the way we hope :)

      Reply
    • Tim Nilimaa says:

      Ps, sorry for late reply!

      Reply
  2. Johann says:

    I’m using this method to deploy .NET 3.5

    After the installation it gives me an error “The software change returned error code 0x87D00324 (-2016410844)

    The application does install though and the appenforce.log doesn’t show any errors. What would be the cause of the failed status?

    Reply
  3. Taylor says:

    How did you create the Package? I am getting the .exe download but 2012 r2 requires and msi.
    Thanks

    Reply
    • Tim Nilimaa says:

      First, Applications in ConfigMgr 2012 R2 accepts exe files if you select to specify the information manually OR select “script” depending on where in the wizard you are. Secondly, I used the data from the source installation media from the SxS folder in the source folder – not anything downloaded.

      Reply

Leave A Reply