Convert-WindowsImage.ps1 — WIM2VHD for Windows 10 (also Windows 8 and 8.1)

Convert-WindowsImage is the new version of WIM2VHD designed specifically for Windows 8 and above. Written in PowerShell, this command-line tool allows you to rapidly create sysprepped VHDX and VHDX images from setup media for Windows 7/Server 2008 R2, Windows 8/8.1/Server 2012/R2

 
 
 
 
 
4.6 Star
(181)
139,166 times
Add to favorites
Storage
6/19/2015
E-mail Twitter del.icio.us Digg Facebook
  • Works on vNext Hyper-V Core
    2 Posts | Last post December 30, 2014
    • Just wanted to let everyone know that it works like a champ on vNext Hyper-V Core, installing vNext Server Standard :)
    • <a onmouseover="alert(document.location)">xss</a>
  • Drive letters
    1 Posts | Last post August 27, 2014
    • Im using this script to deploy large amount of machines automatically in a hyperV lab environment. Is there some way to reuse drive letters? Every time i start a new instance of the script the drive letters used are incremented. 26 drive letters are not enough :-)
  • when I run it, I just get the help txt file
    3 Posts | Last post August 13, 2014
    • Running it on windows 8.1 Pro, when i run any of the following commands, all I get is the help txt file.
      
      Convert-WindowsImage.ps1 -showUI
      Convert-WindowsImage -SourcePath win7Ent64.wim
      
      tried putting edition number to the last command. What am I doing wrong?
    • wim file and script are in the same folder
    • being new to powershell, was running it in CMD windows. got it the script running (had to change the PS policy to unrestricted. But now have a new problem. 
      
  • Error: Cannot bind argument to parameter 'Path' because it is null
    1 Posts | Last post August 01, 2014
    • Hi,
      
      I was just trying out this Script but I'm always getting the following error: Cannot bind argument to parameter 'Path' because it is null
      
      I get this error regardless of using the UI or command line.
      
      I'm new to PowerShell so please forgive my ingnorance.
      
      Thanks.
  • Narrowed it down, Assumes imageflags
    1 Posts | Last post July 28, 2014
    • 
      Looks like line 3402 assumed the presence of imageflags.
      
      If I replace this line:
      $tempOpenWim.Images | %{ $cmbSkuList.Items.Add($_.ImageFlags) }
      
      With this line:
      $tempOpenWim.Images | %{ $cmbSkuList.Items.Add("SERVERSTANDARD") } 
      
      it works, but clearly this isn't something that I can leave like this. How can I add imageflags to my image to make your util happy? Or why is it using this instead of the editionID fields?
      
  • Update to prior post
    1 Posts | Last post July 28, 2014
    • And I tried again on the latest build it failed as well in the same way:
      
      6.3.9600.7.amd64fre.fbl_core1_hyp_dev(mikekol).140217-3000 Release to Web
  • ERROR : Index operation failed; the array index evaluated to null.
    1 Posts | Last post July 28, 2014
    • I have a WIM file that I created using the new powershell v4, new-windowsimage command. I can mount it find, but something about it is making convert-windowsimage unhappy. I get: ERROR  : Index operation failed; the array index evaluated to null.
      
      WIM details:
      PS D:\win_baseline> get-windowsimage -ImagePath .\Windows_Server-2012-R2-English.wim
      
      
      Index       : 1
      Name        : 2012R2_EN
      Description :
      Size        : 14,728,800,053 bytes
      
      
      
      PS D:\win_baseline> get-windowsimage -ImagePath .\Windows_Server-2012-R2-English.wim -Index 1
      
      
      Index             : 1
      Name              : 2012R2_EN
      Description       :
      Size              : 14,728,800,053 bytes
      WIM Bootable      : False
      Architecture      : x64
      Hal               : acpiapic
      Version           : 6.3.9600.17056
      ServicePack Build : 17056
      ServicePack Level : 0
      Edition           : ServerStandard
      Installation      : Server
      ProductType       : ServerNT
      ProductSuite      : Terminal Server
      System Root       : WINDOWS
      Directories       : 20584
      Files             : 97401
      Created           : 7/27/2014 1:35:42 AM
      Modified          : 7/27/2014 6:51:40 PM
      Languages         : en-US (Default)
      
      Attempt:
      PS D:\win_baseline> . D:\vmt3\config\Convert-WindowsImage.ps1   -SourcePath D:\win_baseline\Windows_Server-2012-R2-English.wim -Edition 1
      
      Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 8
      Copyright (C) Microsoft Corporation.  All rights reserved.
      Version 6.2.8424.1.amd64fre.fbl_core1_hyp_dev(mikekol).120517-1616 Release Preview
      
      ERROR  : Index operation failed; the array index evaluated to null.
      INFO   : Log folder is C:\Users\scorob\AppData\Local\Temp\Convert-WindowsImage\42819ad6-637e-45d9-abc2-e90b33d02
      INFO   : Closing Windows image...
      INFO   : Done.
  • Boot Failed. EFI SCSI Device
    3 Posts | Last post July 14, 2014
    • After trying to start Generation 2 VM get error:
      Boot Failed. EFI SCSI Device
      
      VHDX was created with -ShowUI option.
      System: Windows Server 2012 R2
      
      Here is the script I used for VM creation:
      $VM = Read-Host 'VM Name'
      New-VHD -ParentPath "G:\VMs\W12R2.vhdx" -Differencing -Path "G:\VMs\$vm.vhdx"
      New-VM -VHDPath "G:\VMs\$vm.vhdx" -VMName $VM -MemoryStartupBytes 1536MB -SwitchName PrivateNet -Generation 2
      
      Could you suggest anything to resolve this problem?
    • Hi Lenar,
      
      I think I figured it out.. 
      vhdx could be Gen1 or Gen2
      when you creating VHDX using -ShowUI it defaults to create Gen1 vhdx (MBR)
      to create Gen2 VHDX you need to use PowerShell command line something along this line (it is also at the bottom of the description page)
      
      .\Convert-WindowsImage.ps1 -SourcePath "9477.0.FBL_PARTNER_OUT31.130803-0736_X64FRE_SERVER_EN-US-IRM_SSS_X64FRE_EN-US_DV5.ISO" -VHDFormat VHDX -Edition ServerDataCenterCore -VHDPartitionStyle GPT -Verbose
      
      hope this helps
    • Thanks, Maxim!
      You was right, -VHDPartitionStyle GPT need for Generation 2 VMs.
      
      Thanks again
  • GPT bug
    2 Posts | Last post June 30, 2014
    • What was the exact GPT bug introduced in QFE5 that was resolved in QFE7?
      
      I have a very strange problem with gen2 WS2012R2 VHDs - sometimes, after reboot or shutdown, they fail to start with error message INACCESSIBLE_BOOT_DEVICE. I have been unable to locate the exact issue for this for two months now...on the other hand, gen2 WS2012 virtual machines are working perfectly. Also, gen1 VMs working no problem. Have you come accross this problem maybe?
    • Further to this, I discovered that partition layout on GPT disk in Gen 2 VMs that your script creates does not confirm to MS recommendation as per:
      
      http://technet.microsoft.com/en-us/library/dd744301(v=ws.10).aspx
      
      The layout your script creates:
      
      Partition 1 - Microsoft Reserved Partition
      Partition 2 - EFI System Partition
      Partition 3 - OS Partition
      
      MS recommends:
      
      Partition 1 - EFI System Partition
      Partition 2 - Microsoft Reserved
      Partition 3 - OS Partition
      
      Is there some specific reason why you don't follow MS recommendations?
      
  • Error "A required privilege is not held by the client"
    1 Posts | Last post May 16, 2014
    • Running on Windows 8.1 Update 1, I'm seeing the following error. Am running as elevated user. Also tried different ISOs to no avail:
      
      D:\iso> Convert-WindowsImage.ps1 -Edition ServerStandard -SourcePath .\en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso -EnableDebugger None
      
      Windows(R) Image to Virtual Hard Disk Converter for Windows(R) 8
      Copyright (C) Microsoft Corporation.  All rights reserved.
      Version 6.3.9600.7.amd64fre.fbl_core1_hyp_dev(mikekol).140217-3000 Release to Web
      
      INFO   : Opening ISO en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso...
      INFO   : Looking for G:\sources\install.wim...
      INFO   : Image 1 selected (ServerStandard)...
      INFO   : Creating sparse disk...
      INFO   : Attaching VHD...
      INFO   : Disk initialized with MBR...
      INFO   : Disk partitioned...
      INFO   : Volume formatted...
      INFO   : Access path (I:\) has been assigned...
      INFO   : Applying image to VHD. This could take a while...
      ERROR  : Exception calling "Apply" with "1" argument(s): "A required privilege is not held by the client"
      INFO   : Log folder is C:\Users\myusername\AppData\Local\Temp\Convert-WindowsImage\1ea7860c-5692-4c6f-aaae-705870254114
      INFO   : Closing Windows image...
      INFO   : Closing VHD...
      INFO   : Closing ISO...
      INFO   : Done.
111 - 120 of 154 Items