windows-admins / ConfigMgr

GNU General Public License v3.0
225 stars 57 forks source link

ConfigMgr/Scripts/Service_WIM/Service_WIM.ps1 #111

Open scarneol opened 2 years ago

scarneol commented 2 years ago

I do not believe this script will work with Windows 11? It will not export a single wim using the /Imagename. I changed the code at line 63-66 so it uses the Index of the wim when exporting (line 82).

63 if (!($WinVersion -in (Get-WindowsImage -ImagePath $SourceImage).ImageName)) { 64 Write-Warning "No such image $WinVersion found in $SourceImage" 65 Exit 66 }else { 67 #Get Image Index 68 $ImageIndex = (Get-WindowsImage -ImagePath $SourceImage -Name $WinVersion).ImageIndex 69 Write-Debug "Image Index $ImageIndex has been found in $SourceImage" 70 }

82 $dism_wait = Start-Process $dism -PassThru -ArgumentList "/export-image /SourceImageFile:"$SourceImage" /SourceIndex:"$ImageIndex" /DestinationImageFile:"$SourceDirectory\install-temp.wim""