5
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.

MDMoore313
  • 5,531
  • 6
  • 34
  • 73
  • This may be a dumb suggestion, but have you tried typing out 'Maximum' instead of the abbreviated 'Max'? – Ryan Ries Jun 30 '14 at 12:59
  • 1
    I also see this open bug opened just last month: http://connect.microsoft.com/PowerShell/feedback/details/875599/new-windowsimage-compressiontype-does-not-appear-to-compress – Ryan Ries Jun 30 '14 at 13:00
  • Thanks. How did you find this? – MDMoore313 Jun 30 '14 at 13:06
  • Yep, I tried `Max, Maximum,` and `None`. – MDMoore313 Jun 30 '14 at 13:11
  • 2
    It sounds crazy but try "max" lowercase. New-WindowsImage -CapturePath K: -ImagePath C:\VHDImports\Win764.wim -name "BigHomies Personal Image" -Verify -CompressionType max – Bin Jul 02 '14 at 15:24
  • @Bin you're right, that *does* sound crazy. – MDMoore313 Jul 02 '14 at 15:35
  • @BigHomie I know not what lurks in the hearts of .Net/Powershell developers who decided to make parameters case sensitive. Seriously it worked for me. – Bin Jul 02 '14 at 15:54
  • @Bin well, it *did* get me past the error message, I'll be comparing it with the uncompressed version to see if there is a size difference of course. However, your suggestion did resolve my error message, so feel free to post it as answer, , and if it doesn't compress then note the known bug submitted to MS as well. – MDMoore313 Jul 02 '14 at 15:59
  • @BigHomie I tested it. It does compress the image thankfully. I created a bug report on connect.microsoft.com "https://connect.microsoft.com/PowerShell/feedback/details/911766/new-windowsimage-compressiontype-parameter-only-accepts-lowercase-inputs". Will you please post that you receive the same results? – Bin Jul 02 '14 at 17:13
  • @Bin it didn't compress mine, old and new are both 17 gigs. – MDMoore313 Jul 02 '14 at 17:23
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/15497/discussion-between-bin-and-bighomie). – Bin Jul 02 '14 at 17:30

1 Answers1

2

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
Bin
  • 844
  • 5
  • 15