Using PowerShell to Convert a VHD to a VHDX
Yesterday I showed you how to convert a VHD file to a VHDX using the Hyper-V Manager user interface. Today I want to show you that it is even easier to do using PowerShell:
All you need to do is run the following command:
Convert-VHD .\test.vhd .\test.vhdx
We will figure out whether you want the new file to be a VHD or VHDX depending on the file extension that you provide. You can also specify whether you want a dynamic or fixed disk – but that is optional.
Cheers,
Ben
Comments
Anonymous
October 03, 2012
Excellent , just like VHDtool.exe but running from powershell.Anonymous
October 03, 2012
Hi ben, is the 'FileSize' before & after conversion correct?Anonymous
October 03, 2012
The comment has been removedAnonymous
October 04, 2012
Mario - Yes, VHDX files tend to be a bit larger than VHD files - as we preallocate a buffer for performance reasons. Cheers, BenAnonymous
October 12, 2012
Hi Ben, what is the use of -passthru option in the convert-vhd commandAnonymous
October 16, 2013
The problem we are facing is that we convert a .VHD to .VHDX using powershell, the .VHDX file is unusable. If we convert the VHD to VHDX using the HyperV settings (GUI) the .VHDX does work. Is there any difference in the conversion process when using PowerShell and when using the GUI? Are there any parameters we forget to specify in PowerShell?Anonymous
March 11, 2014
would it work for avhdx files as well? in fact, I want to know how would I convert a sequence of vhdx and avhdx files to vhd and avhd so that I keep that parent-child relationship between the converted files as well.Anonymous
September 27, 2015
You don't mention that this is a script, or where to get it from. Quite pertinent info buddy. I've only just become aware of VHDx. I've not used Hyper-v - is it 'just' like VirtualBox / VMWARE ? OK, now the big q, these vhdx things, in fact ALSO these PowerShell cmdlets for VHD/VHDx mgmt... Is it specifically, and exclusively, concerning Hyper-V virtual-drives? I'm asking as I'm a native Win(7/10/Server) VHD user, and curious about the new VHDx format. Thanks!Anonymous
November 27, 2015
The comment has been removedAnonymous
March 29, 2016
Servicios: Administración de Servidores, Reventa de dedicados administrados de OVH, Backup y Monitorizacion. Asesoramos y aconsejamos a nuestros clientes, ofrecemos soluciones rápidas y económicas ante la avería de un electrodoméstico Bosch. Si desea contactar con nosotros puede hacerlo por teléfono llamando al Servicio de atención al cliente bien utilizando nuestro formulario de contacto. Si su electrodomésticoBosch, Salta Alarma y solicita nuestros servicios, le enviaremos un técnico a la mayor brevedad para que le confeccione un presupuesto. Una vez aceptado el técnico reparará su electrodomésticoBosch con piezas originales, y una vez finalizado el trabajo comprobará su correcto funcionamiento. Por todo ello, trabajar con Muñoz Bosch le supone el trabajar con una doble garantía, la del fabricante y la de Muñoz Bosch.