From 9e2da741d53652e6e600ca19cfd38f507bd01fde Mon Sep 17 00:00:00 2001 From: rbalsleyMSFT <53497092+rbalsleyMSFT@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:27:20 -0700 Subject: [PATCH] Fix issue with single index wims that don't have a 4th index --- FFUDevelopment/BuildFFUVM.ps1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 2f7f70f..110d92c 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -892,9 +892,15 @@ function Get-Index { # Get the available indexes using Get-WindowsImage $imageIndexes = Get-WindowsImage -ImagePath $WindowsImagePath - # Get the ImageName of ImageIndex 4 - this is usually Home or Education SKU on ESD MCT media - $imageIndex4 = $imageIndexes | Where-Object ImageIndex -eq 4 - $WindowsImage = $imageIndex4.ImageName.Substring(0, 10) + # Get the ImageName of ImageIndex 1 if an ISO was specified, else use ImageIndex 4 - this is usually Home or Education SKU on ESD MCT media + if($ISOPath){ + $imageIndex = $imageIndexes | Where-Object ImageIndex -eq 1 + $WindowsImage = $imageIndex.ImageName.Substring(0, 10) + } + else{ + $imageIndex = $imageIndexes | Where-Object ImageIndex -eq 4 + $WindowsImage = $imageIndex.ImageName.Substring(0, 10) + } # Concatenate $WindowsImage and $WindowsSKU (E.g. Windows 11 Pro) $ImageNameToFind = "$WindowsImage $WindowsSKU"