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)
142,264 times
Add to favorites
Storage
6/19/2015
E-mail Twitter del.icio.us Digg Facebook
  • ERROR : No Source Path Specified
    5 Posts | Last post July 02, 2015
    • Hi All,
      
      Every attempt to convert an ISO or WIM using the -ShowIU results in failure, the error log is below, can anyone advise as this is driving me crazy: -
      
      **********************
      Windows PowerShell transcript start
      Start time: 20150630120619
      Username: IC\dyeo
      RunAs User: IC\dyeo
      Machine: CC-DYEO-LAP (Microsoft Windows NT 6.3.9600.0)
      Host Application: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe
      Process ID: 7484
      **********************
      INFO   : Launching UI...
      
      PS>TerminatingError(Test-IsNetworkLocation): "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."
      ERROR  : No source path specified.
      INFO   : Log folder is C:\Users\<xxxx>\AppData\Local\Temp\Convert-WindowsImage\72044856-1d95-4753-81d7-4029658732be
      INFO   : Done.
      **********************
      Windows PowerShell transcript end
      End time: 20150630120825
      **********************
      
      
      
    • Got the same problem here...
      
      I got the Version of 19.06.2015, but if I try .\Convert-WindowsImage.ps1 -ShowUI  it won't show anything. Just root.
      Then I tried the advise of Cesar de la Torre, but then I get same error like DJYeo.
      In my case I try to convert a Win10 ISO to a vhd with fixed size for Azure.
      
      Could someone help me please?
    • Hi,
      
      There is a small snag in the code. Search for "$script:SourcePath" and replace it with "$SourcePath".
      Make sure to dot source again the script to update the function in your console.
    • Additionaly to the post before - success with the change - this change seems to be also necessary
    • I have to recall ==> the change helped, but stil no success
      ERROR  : No source path specified.
      Gui is working and with replacement of the variable I can choose an ISO Image, but not able to convert
  • Custom Images
    1 Posts | Last post June 30, 2015
    • I've been trying to get this to work with a sysprepped corporate image we use.  I kept getting the "The variable cannot be validated because the value  is not a valid value for the Edition variable."  It's the only image in the .wim, and Edition 1 wasn't working.  It was dying on line 4077 when it tried to open the image.  The ImageName in the .wim was "Windows", so I just hard coded the $Edition variable to "Windows" and it worked.  Don't know if this will help anyone or not.
  • No output
    2 Posts | Last post June 27, 2015
    • Hi I'm running the following command
      
      .\Convert-WindowsImage.ps1 -WIM .\NanoServer\NanoServer.wim -Size 10GB -VHDFormat VHD -Edition 1
      
      And nothing happens. It still Works fine with the previus version.
      
      Any suggestions ?
      
      Steen
    • Open the script with PoewrShell ISE rather than plain Powershell, and as admin.
      you´ll see the function in the editor.
      Scroll down, and write the call to the function right at the end, after the function as:
      
      Convert-WindowsImage -ShowUI
      
      Execute the whole script within PowerShell ISE. You´ll see the UI Windows, etc.
  • I try both scripts which they advise me in Technet Forum to convert iso.to vhdx but it is not working
    2 Posts | Last post June 27, 2015
    • hi,
      I have tried to convert OEMEssentials.iso to  OEMEssentials.vhdx with this 2 commands which they advise me in Technet Forum :
      1--Powershell -ExecutionPolicy Unrestricted -Command "& {C:\scripts\Convert-WindowsImage.ps1 -VHDFormat vhdx -sizebytes 127GB –sourcepath C:\OEMEssentials.iso -vhdpath C:\OEMEssentials.vhdx}"
      2--Powershell -ExecutionPolicy Unrestricted -File C:\scripts\Convert-WindowsImage.ps1 -VHDFormat vhdx -sizebytes 127GB –sourcepath C:\OEMEssentials.iso -vhdpath C:\OEMEssentials.vhdx .
        but  nothing  happens ,there is no any action or folder on C:\ directory whith name OEMEssentials.vhdx here below my directories which I copied from powershell:
      Windows PowerShell
      PS C:\> Powershell -ExecutionPolicy Unrestricted -Command "& {C:\scripts\Convert-WindowsIm
      ytes 127GB -sourcepath C:\OEMEssentials.iso -vhdpath C:\OEMEssentials.vhdx}"
      PS C:\> get-childitem
          Directory: C:\
      Mode                LastWriteTime     Length Name
      ----                -------------     ------ ----
      d----         24-6-2015     12:35            essentials-image
      d----         21-3-2014     20:24            essentials-mount
      d----          8-9-2012      9:26            inetpub
      d----         24-6-2015     11:47            NVIDIA
      d----         14-7-2009      5:20            PerfLogs
      d-r--         14-6-2015     15:54            Program Files
      d-r--         21-6-2015     22:13            Program Files (x86)
      d----         27-6-2015     10:55            scripts
      d----          9-7-2014     19:09            ServerFolders
      d-r--         20-5-2010     15:56            Users
      d----         10-6-2015     14:25            Windows
      -a---         26-6-2015     12:12 4542291968 OEMEssentials.iso
      PS C:\> cd scripts
      PS C:\scripts> get-childitem
      -a---         25-6-2015     21:24     206093 Convert-WindowsImage.ps1  
      how I can solve this problem what is wrong with this 2 scripts?
      thanks
      johan         
            
    • Open the script with PoewrShell ISE rather than plain Powershell, and as admin.
      you´ll see the function in the editor.
      Scroll down, and write the call to the function right at the end, after the function as:
      
      Convert-WindowsImage -ShowUI
      
      Execute the whole script within PowerShell ISE. You´ll see the UI Windows, etc.
      
  • Скрипт не распознаёт ISO-образ
    4 Posts | Last post June 25, 2015
    • Если версия скрипта Convert-WindowsImage.ps1 от 19.06.2015 у вас не запускается, как это показано в видео Игоря (https://www.youtube.com/watch?v=uVd-IxhkKMU), то необходимо его запускать так:
      
      1) . .\Convert-WindowsImage -ShowUI
      2) Convert-WindowsImage -ShowUI
      
      Но я столкнулся с другой проблемой, которую можно увидеть на данном скриншоте: http://i.imgur.com/KQ714Lm.png — ошибка эта появляется после того как я выбираю ISO образ, который скачан с официальной страницы MS.
    • If script don't run, try (without .sp1):
      1). .\Convert-WindowsImage -ShowUI 
      2)Convert-WindowsImage -ShowUI 
      
      For me works only 2)Convert-WindowsImage -ShowUI
    • You can use Step-by-step guide from here: http://blogs.technet.com/b/nanoserver/archive/2015/06/16/powershell-script-to-build-your-nano-server-image.aspx
      Hope it helps
    • This is what you need to do:
      
      Copy the files to a directory on your hard drive.
      Launch PowerShell.   I usually launch a CMD in administrative mode then I run powershell.
      go tot he directory where you copy the files.
      Run . .\Convert-WindowsImage.ps1
      Make sure that between the dots there is a space. That will load it as a function.
      Now when you run the script to create you VHD, make sure there are no dots or back slashes.   To create the VHD from the nanoserver folder, this is the command.
      
      Convert-WindowsImage -Sourcepath c:\nanoserver\NanoServer.wim -VHD c:\Nanoserver\nanoserver.vhd –VHDformat VHD -Edition 1
      
      As you can see, the command has no .\ in it.
      
  • Failure with Nanoserver
    1 Posts | Last post June 17, 2015
    • Running this on Windows 8.1 to build VHD for nanoserver failed with the message:
      ERROR  : Cannot convert the "System.String[]" value of type "System.String[]" to type "System.Int32".
      
      The command used was:
      Convert-WindowsImage -WIM d:\software\Microsoft\Windows\nanoserver\NanoServer\NanoServer.wim -VHD d:\software\Microsoft\Windows\nanoserver\NanoServer.vhd -DiskType Fixed -VHDFormat VHD -SizeBytes 10GB -Edition 1
      
      I tracked this down with the debugger and fixed it by changing line 4092 to:
      $openImage = $openWim[[Int32]::Parse($Edition)]
      
      Gary
  • no output
    2 Posts | Last post June 17, 2015
    • hello all
      when i execute the script (.\Convert-WindowsImage.ps1 -ShowUI) or any other parameter nothing happen and no error received , i try it on many systems same result.
      any help please
      thx
    • The script is now a function. you have to ". .\ Convert-WindowsImage.ps1" first, then run the command (without .ps1).
  • Windows 10 is not properly detected
    3 Posts | Last post May 31, 2015
    • When running the script on Windows 10 - 10074 the scripts doesn't validate properly the version of the operating system
      
      This is the problematic part: 
      
      Function Test-WindowsVersion {
              $os = Get-WmiObject -Class Win32_OperatingSystem 
              $isWin8 = (($os.Version -ge 6.2) -and ($os.BuildNumber -ge $lowestSupportedBuild))
      
              Write-W2VTrace "isWindows8? $isWin8"
              return $isWin8
          } 
      
      This is what happens
      
      PS C:\Users\josefern\Downloads> $os
      SystemDirectory : C:\WINDOWS\system32
      Organization    : Microsoft IT
      BuildNumber     : 10074
      RegisteredUser  : Microsoft Corp.
      SerialNumber    : 00261-30000-00000-AA291
      Version         : 10.0.10074
      
      PS C:\Users\josefern\Downloads> $os.Version -ge 6.2
      False
      
      PS C:\Users\josefern\Downloads> $os.BuildNumber -ge $lowestSupportedBuild
      False
      
      
      
    • This is an issue that turned out once build numbers passed 10000. They are actually returned as strings, not integer values. This means 10074 is actually less than 9200 (because it starts with a 1, compared to a 9).
      
      Easiest way here: correct the line to
      $isWin8 = $true
      
      More elegant way: 
      $isWin8 = (($os.Version -ge 6.2) -and ([int]$os.BuildNumber -ge [int]$lowestSupportedBuild))
      
      Untested yet, but should work.
      
    • The fix doesn't quite work because the ($os.Version -ge 6.2) test also fails. Implicit Casting $os.version to float throws an error. This works though:
      
      $isWin8 = (([float]($os.Version.Split('.')[0]+'.'+$os.Version.Split('.')[1]) -ge 6.2) -and ([int]$os.BuildNumber -ge [int]$lowestSupportedBuild))
      
      I've tried this on Windows 10, Windows 8.1 and faked it on Windows 7 to ensure it returns false. There are probably nicer ways of doing this.
  • problems with Convert-WindowsImage
    1 Posts | Last post May 28, 2015
    • Hello everybody,
      always get the same error as the image to be seen.
      No matter what language.
      
      INFO   : Launching UI...
      INFO   : Opening ISO W12R2EN.iso...
      INFO   : Looking for J:\sources\install.wim...
      INFO   : Scanning WIM metadata...
      INFO   : Image 4 selected (ServerDataCenter)...
      INFO   : Creating sparse disk...
      INFO   : Attaching VHDX...
      INFO   : Disk initialized with MBR...
      INFO   : Disk partitioned...
      INFO   : Volume formatted...
      INFO   : Access path (E:\) has been assigned...
      INFO   : Applying image to VHDX. This could take a while...
      ERROR  : Ausnahme beim Aufrufen von "Apply" mit 1 Argument(en):  "Dem Client fehlt ein erforderliches Recht"
      INFO   : Log folder is C:\Users\jkrause\AppData\Local\Temp\Convert-WindowsImage\68736bc9-c6b8-47e7-aa68-bfb5185a5546
      INFO   : Closing Windows image...
      INFO   : Closing VHDX...
      INFO   : Done.
      
      Thanks for the answer
  • failes on custom WIM files
    1 Posts | Last post May 13, 2015
    • This fails on any image created with
      New-WindowsImage -CapturePath C:\VHDMount -Name MyImage -ImagePath C:\CapturedWIMs\2012r2.wim -Description “MyCustomeImage” -Verify
      
      If I comment out lines 4021-4024 and line 4038 and supply -Edition 1 then it works.
91 - 100 of 154 Items