Powershell DISM New-Windows Image: Using a CompressionType gives an error

PS C:\ProgramData\Microsoft\Windows\Hyper-V\BigHomie> New-WindowsImage -CapturePath K: -ImagePath C:\VHDImports\Win764.wim -name "BigHomies Personal Image" -Verify -CompressionType "Max"

Throws the following error:

    New-WindowsImage : The given key was not present in the dictionary.
At line:1 char:1
+ New-WindowsImage -CapturePath K: -ImagePath C:\VHDImports\Win764.wim -name " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-WindowsImage], KeyNotFoundException
    + FullyQualifiedErrorId : System.Collections.Generic.KeyNotFoundException,Microsoft.Dism.Commands.NewWindowsImageC
   ommand

I'll say running this command w/out the -CompressionType parameter runs and gives an uncompressed .wim file. Running this w/out giving an argument to the -CompressionType parameter gives an error that I need to supply an argument of type System.String.

Google turns up little about this specific error, none of which seems applicable to my situation, and none of those results are about the error happening with powershell, let alone this particular cmdlet.


Solution 1:

The "CompressionType" parameter seems to only accept lower-case strings max, fast and none.

Use the following command instead:

New-WindowsImage -CapturePath K: -ImagePath C:\VHDImports\Win764.wim -name "BigHomies Personal Image" -Verify -CompressionType max