.NET 3.5 Framework prerequisite before deploying

I have a Fixlet that before executing asks for some variables and then enters the keyed in variables into a PowerShell script then deploys and runs. An issue I have encountered is I need the .NET 3.5 Framework to be installed. Is there a way I can add that to the BigFix Action Script? I tried to using Relevance but that just makes the host I need to deploy it to not, it isn’t relevant. :slight_smile:

I was trying to find some examples but I just got more confused on how the syntax for the Action Script would look like. Some were using bat files to call other items. I am thinking I am making this harder than it actually is but not sure on the syntax to check for .NET 3.5 Framework and if not installed download and install it.

What OS’s do you need to target? If I recall correctly .NET varies by OS - on Win2016 and Win7, I believe it is a “feature” that needs to be enabled via DISM, while on other OS it may be a download & install.

Sorry primarily Win2016 and a handful of Win2019.

If it helps, this is the reg key to look at to determine if .NET 3.5 is installed (if exists) this is the version and servicepack. Some code I pulled from a PowerShell script I wrote.

Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5’ -Name ‘Version’ | Select-Object -ExpandProperty ‘Version’

Get-ItemProperty ‘HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5’ -Name ‘SP’ | Select-Object -ExpandProperty ‘SP’

Essentially, in your actionscript you need to add an if-endif block so you can check for the .NET version and install/enable if not. You will need to find a machine that has it, so you can validate the registry key. From the info posted by @DerrickD it looks like it would be something along the lines of the below, however you may need to check against a value of the key, instead of the existence of the key itself. Check on a machine that doesn’t have it to be sure your relevance will work as expected. Also note that when you add relevance to actionscript, you need to wrap it with {}.

if {not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" of registry}

After this, you can add your DISM command to enable the feature as suggested by @JasonWalker

If the server has internet access you can simply have it pulled within the DISM command. However, if you need to have it installed without internet access you can do so using DISM with a local source, and prefetch the package via BigFix.

e.g.in online mode:

waithidden cmd.exe /c DISM /Online /Enable-Feature /FeatureName:NetFx3 /All

then, the next line after the DISM command you need to add ‘endif’ so the actionscript will resume with the rest of your commands.

Your actionscript structure should look like:


if {relevance to check .NET}
waithidden cmd.exe /c DISM command
endif

If you need to account for other scenarios (e.g.if the DISM command differs for Server 2019) then you can add an ‘elseif’ and include the additional checks in the relevance.


if {scenario 1}
outcome 1
elseif {scenario 2}
outcome 2
endif

replying on mobile. I will tidy this reply up when I’m back at my computer

1 Like