Error 16389 for .Net Framework 4.6.2 as an SCCM Application

You may have previously stumbled across the error 16389 for .Net Framework 4.6.2 as an SCCM Application. To resolve this I attempted the ‘fix’ provided here. But even when I checked the ‘Run installation and uninstall program as 32-bit process on 64-bit clients’ () i still had the issue.

Error 16389 for .Net Framework 4.6.2 as an SCCM Application

It appears it’s a memory issue when SCCM extracts the compressed .Net installer. So here’s how I fixed it:

So, first download the offline installer from here.

Now, using 7-Zip, extract the contents of NDP462-KB3151800-x86-x64-AllOS-ENU.exe to a folder of your choice.

Now select all of the extracted content (hold down shift or ctrl to select multiple), right-click, 7-Zip and Add to Archive.

Then use settings similar to the following – ensure you check ‘Create SFX archive’ and name the archive as an executable:

Add To Archive

Click OK and it will create a self extracting executable. By default the extraction method isn’t silent – it shows a progress bar in a GUI. But we can make it run silently by using the following VBScript file to perform the extraction and installation:

Option Explicit
Dim objShell : Set objShell = CreateObject("Wscript.Shell")
Dim strPath : strPath = Wscript.ScriptFullName
Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objFile : Set objFile = objFSO.GetFile(strPath)
Dim strFolder : strFolder = objFSO.GetParentFolderName(objFile) 
Dim strExecutable : strExecutable = strFolder & "\W7_Microsoft_DotNet_462_EN_001_F.exe"
Dim strTempFolder : strTempFolder = objFSO.GetSpecialFolder(2)
Dim strTempExtractionFolder : strTempExtractionFolder = strTempFolder & "\netfw"
Dim strExtractionCommandLine : strExtractionCommandLine = chr(34) & strExecutable & chr(34) &  " -o" & chr(34) & strTempExtractionFolder & chr(34) & " -y"
'extract installation files to temp folder
objShell.Run strExtractionCommandLine,0,true
Dim strInstallCommandLine
Dim strInstallCommandLineExitCode : strInstallCommandLineExitCode = 0
'install dot net
If Is32BitOS() Then
strInstallCommandLine = chr(34) & strTempExtractionFolder & "\setup.exe" & chr(34) & " /q /norestart /ChainingPackage " & chr(34) & "ADMINDEPLOYMENT" & chr(34) & " /log " & chr(34) & strTempFolder & "\netframework" & chr(34) & " /x86"
strInstallCommandLineExitCode = objShell.Run (strInstallCommandLine,0,true)
Else
strInstallCommandLine = chr(34) & strTempExtractionFolder & "\setup.exe" & chr(34) & " /q /norestart /ChainingPackage " & chr(34) & "ADMINDEPLOYMENT" & chr(34) & " /log " & chr(34) & strTempFolder & "\netframework" & chr(34) & " /x64"
strInstallCommandLineExitCode = objShell.Run (strInstallCommandLine,0,true)
End If
'delete extracted folder
objFSO.DeleteFolder strTempExtractionFolder, true
'close objects
Set objFile = Nothing
Set objFSO = Nothing
Set objShell = Nothing
'quit with exit code
WScript.Quit(strInstallCommandLineExitCode)
'function to see if OS is x86 or not
Function Is32BitOS()
Const Path = "winmgmts:root\cimv2:Win32_Processor='cpu0'"
Is32BitOS = (GetObject(Path).AddressWidth = 32)
End Function

The default .Net executable is heavily compressed. When extracted it extracts to over 1gb! So I would suggest it’s worthwhile compressing it like above using 7-Zip (which doesn’t compress it quite as well, admittedly.)

Finally, the detection method:

.Net Detection Method

You can find the relevant release number for your version of .Net from here.