Fix issue with single index wims that don't have a 4th index

This commit is contained in:
rbalsleyMSFT
2024-04-12 12:27:20 -07:00
parent 6fd5a4a41f
commit 9e2da741d5
+9 -3
View File
@@ -892,9 +892,15 @@ function Get-Index {
# Get the available indexes using Get-WindowsImage # Get the available indexes using Get-WindowsImage
$imageIndexes = Get-WindowsImage -ImagePath $WindowsImagePath $imageIndexes = Get-WindowsImage -ImagePath $WindowsImagePath
# Get the ImageName of ImageIndex 4 - this is usually Home or Education SKU on ESD MCT media # 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
$imageIndex4 = $imageIndexes | Where-Object ImageIndex -eq 4 if($ISOPath){
$WindowsImage = $imageIndex4.ImageName.Substring(0, 10) $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) # Concatenate $WindowsImage and $WindowsSKU (E.g. Windows 11 Pro)
$ImageNameToFind = "$WindowsImage $WindowsSKU" $ImageNameToFind = "$WindowsImage $WindowsSKU"