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
142,265 times
Add to favorites
E-mail Twitter Digg Facebook
  • Howto: Windows 10
    1 Posts | Last post November 03, 2015
    • How to run this script on Windows 10:
      1) Import-Module .\Convert-WindowsImage.ps1
      2) Convert-WindowsImage <params>
      Note: GUI mode (-showUI switch) does not work on win-10 
    1 Posts | Last post November 02, 2015
    • Hi All,
      I am keep changing and choosing the D: as a working directory but it keeps creating image on the default working directoiry which it was 
      and now is
      c:\windows\System32 is 
      and I heard if I chose a specific directory but it keeps creating image in the default one and doesn't  save the image on the path I give MEANS IMAGE IS NOT WOKRING AND IS NOT CORRECT?
       and if yes how can I fix this issue?
      thank you!
  • .\Convert-WindowsImage.ps1 -ShowUi
    1 Posts | Last post October 30, 2015
    • i get this first:
      Unhandled exception has occurred in a comparison in your application. If you click Continue, the application will ignore this error and attempt to continue. UNABLE to load WIM metadata! 
      - I don't have anything in SKU list drop box
      I leave VHD DYNAMIC 40 GB ...and chose D: as working Directory and put Test.vhd name on VHD name. and click on " Make my VHD" then 
      i get error below:
      ERROR  : The variable cannot be validated because the value  is not a valid value for the Edition variable.
  • Exception when using -ShowUI
    1 Posts | Last post October 27, 2015
    • Good evening
      Thanks a lot for this great tool!, unfortunately, the release which I downloaded today runs in a Null exception when used with the -ShowUI argument, just after selecting the iso file.
      As a C# Developer Powershell usually behaves very strange (and not as expected) - this time too.
      Please look at my comments "# tom:"
      $openIso     = Get-DiskImage -ImagePath $isoPath
      $driveLetter = ($openIso | Get-Volume).DriveLetter
      $script:SourcePath  = "$($driveLetter):\sources\install.wim"
      Write-W2VInfo "Looking for $($SourcePath)..."
      # tom: ISE Tooltip shows here the following;
      # $script:SourcePath = F:\sources\install.wim
      # $SourcePath = 
      # --> Because $SourcePath ist empty, the next command will throw the exception:
      if (!(Test-Path $SourcePath)) {
      	Write-W2VInfo "3"
      	throw "The specified ISO does not appear to be valid Windows installation media."
      Kind regards,
  • DiskPart Workaround
    1 Posts | Last post October 16, 2015
    • I found that the DiskPart steps on line 4189-4193 were throwing an error: Program 'DiskPart.exe' failed to run: Object reference not set to an instance of an object.  I worked around this by replacing those lines as follows, to dump the commands first to a script file instead of running the inline block directly.  (I also had to apply some of the Edition fixes mentioned elsewhere in the Q&A):
      $DiskPartScript = "$((Get-Location).Path)\DiskPartScript.txt"
      select disk $($disk.Number)
      select partition $($partitionSystem.PartitionNumber)
      format fs=fat32 label=System
      "@ | Out-File -FilePath $DiskPartScript -Encoding ascii -Force
      $Exe = "$env:SystemRoot\System32\DiskPart.exe"
      $Arg = "/s $DiskPartScript"
      $Res = Invoke-Expression -Command "$Exe $Arg" | Out-Null
      Remove-Item -Path $DiskPartScript -Force 
  • Not working for me
    3 Posts | Last post October 10, 2015
    • this script it not working me for me at all and not throwing any error even when I run it 
    • The script doesn't work for me either... tried on Windows Server 2012 R2 and Windows 8.1 without success. Execution Policy was set to RemoteSigned or Unrestricted
    • They have changed the script so it creates a function. Run the script the you can use the function without the ./ notation.
  • nothing happens
    1 Posts | Last post October 06, 2015
    • running powershell in sever 2012 r2. run powershell as admin, and set-executionpoliy unrestricted -force. run .\convert-windowsimage.ps1 , nothing happens at all. is this scripting working in server 2012 r2?
  • ShowUI does nothing
    2 Posts | Last post October 02, 2015
    • Can someone make -ShowUI flag work again? :-( it does nothing on Windows 10 and it is really helpful for non IT guys like me.
    • did it work for you? 
      I am trying to run it on windows server 2012 r2.... and the UI doesn't show
  • Script breaks in line 4244 - Drive not found
    1 Posts | Last post September 15, 2015
    • When I run convert-windowsimage, I always get an error with the current version when I try to convert a Windows Server 2016. The Script breaks in line 4244 with error-message "Drive was not found". 
      I played a while with the script to identify the bug, but it is very odd. The drive is visible in Windows-Explorer. When I try to access the drive via set-location (in the script by adding a line) it is not available. When I set a breakpoint at line 4242 and verify the drive, it is available and when I continue the script it is finishing without errors. Very strange. Anyone any ideas?
  • Cannot validate argument on parameter 'Path'
    1 Posts | Last post September 10, 2015
    • Hi I have tried to run this script on Win8.1, and have some tah issue  to the source Wim, I have tried sevral Windows 2012 R2 ISO from MS.
      Does this Convert-WindowsImage script work? 
      ************** Exception Text **************
      System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'Path'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. ---> System.Management.Automation.ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
         at System.Management.Automation.ValidateNotNullOrEmptyAttribute.Validate(Object arguments, EngineIntrinsics engineIntrinsics)
         at System.Management.Automation.ParameterBinderBase.BindParameter(CommandParameterInternal parameter, CompiledCommandParameter parameterMetadata, ParameterBindingFlags flags)
61 - 70 of 154 Items