Inject dot net 3.5 into Windows 11 wim before adding image to SCCM
Previously Windows has been ok with using a dot net package from a different month, so you could add it during the task sequence without much trouble. Now you need the right version. Best way to do this is have a process to inject the wim then copy it to the network folder.
Script lets you pick the iso, mounts it, extracts Enterprise Wim, injects dot net, copies wim to network folder. Then copies the wim path to clipboard
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
#File Picker Function Get-FileName($initialDirectory) { [System.Reflection.Assembly]::LoadWithPartialName(“System.windows.forms”) | Out-Null $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog $OpenFileDialog.initialDirectory = $initialDirectory $OpenFileDialog.filter = “Isos| *.iso” $OpenFileDialog.ShowDialog() | Out-Null $OpenFileDialog.filename } # Vars $date = (Get-Date -UFormat "%d-%b-%Y") $name = "Windows 11 22H2 Enterprise $date" $networkFolder = "\\NetworkPath\Windows 11 22H2\$name" write-host "Choose Windows 11 ISO" $iso = Get-FileName -initialDirectory “c:\users\connor\downloads” $isoMount = Mount-DiskImage -ImagePath $iso -NoDriveLetter #set up dirs rmdir "$env:TEMP\Images\" -Force -recurse -ErrorAction SilentlyContinue mkdir "$env:TEMP\Images\" -ErrorAction SilentlyContinue mkdir "$env:TEMP\Images\mount" -ErrorAction SilentlyContinue #Export image Export-WindowsImage -SourceImagePath "$($isoMount.DevicePath)\sources\install.wim" -SourceIndex 3 -DestinationImagePath "$env:TEMP\Images\install.wim" -DestinationName $name #mount new wim Mount-WindowsImage -ImagePath "$env:TEMP\Images\install.wim" -Index 1 -Path "$env:TEMP\Images\mount" #add dot net Enable-WindowsOptionalFeature -Path "$env:TEMP\Images\mount" -FeatureName "NetFx3" -Source "$($isoMount.DevicePath)\sources\sxs\" #unmount clean up Dismount-WindowsImage -Path "$env:TEMP\Images\mount" -Save mkdir "$networkFolder" Copy-Item "$env:TEMP\Images\install.wim" $networkFolder Dismount-DiskImage -DevicePath $isoMount.DevicePath #copy path for CM Set-clipboard -value "$networkFolder\Install.wim" |
There are no comments yet, add one below.