Convert-WindowsImage
Convert-WindowsImage copied to clipboard
Directly use index if Edition fits exactly
In command I have: -Edition "Windows Server 2022 SERVERSTANDARD"
Yet output shows:
Windows(R) Image to Virtual Hard Disk Converter for Windows(R)
Copyright (C) Microsoft Corporation. All rights reserved.
Copyright (C) 2019 x0nn
Version 10.0.14278.1000.amd64fre.rs1_es_media.160201-1707
WARNING: 2022-01-22T08:16:22 [SP-P-MEDIA] The following images are in the image:
WARNING: 2022-01-22T08:16:22 [SP-P-MEDIA] Name: "Windows Server 2022 SERVERSTANDARDCORE" (Index: 1)
WARNING: 2022-01-22T08:16:22 [SP-P-MEDIA] Name: "Windows Server 2022 SERVERSTANDARD" (Index: 2)
Write-LogMessage : 2022-01-22T08:16:22 [SP-P-MEDIA] There is more than one WindowsImage (Edition) available. Choose
with -Edition using Name oder Index from the list above.
At C:\Convert-WindowsImage.ps1:2394 char:13
+ Write-LogMessage $_ -logType Error
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-LogMessage
Line 1848
Adjust, so it reads:
{$_.ImageName -ilike "*$($Edition)"}
Remove the second asterix * after Edition
I will add the code to check if the Edition-string fits exactly. You can use the index for now.
I could not figure out what it accepted as Index (because the number or the name was not accepted)
Did you try:
-Edition 1 for example?
Sure, could not find combination that got accepted
Can confirm that using -Edition [int] will in fact select the correct edition. I used it with -Edition 6, see the log below.
VERBOSE: 2022-06-08T08:03:20 [HOSTNAME] Looking for the requested Windows image in the WIM/ESD file...
VERBOSE: 2022-06-08T08:03:24 [HOSTNAME] Image 6 selected "Windows 11 Pro"
VERBOSE: 2022-06-08T08:03:24 [HOSTNAME] Creating sparse disk...