将VHDX转换为VHD(无法识别Get-VHD和Convert-VHD)

时间:2015-10-26 15:45:45

标签: powershell azure vhd

我想将一些VHDX文件转换为VHD,以便我可以将它们上传到Microsoft Azure,因为我必须将一些服务器迁移到公司的云端。问题是,我的服务器似乎不知道PowerShell中的VHD命令。

Get-VHD : The term 'Get-VHD' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-VHD -Path * | %{Convert-VHD -Path $_.Path -DestinationPath ($_.Pa ...
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-VHD:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Convert-VHD -Path ".\VHDName.vhdx" -DestinationPath ".\VHDName.vhd"

Convert-VHD : The term 'Convert-VHD' is not recognized as the name of a cmdlet, function, script file, or operable
    program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + Convert-VHD -Path ".\Windows 8.1 x86 Update1 UpdatePack Upgrade.vhdx" ...
    + ~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Convert-VHD:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException

有没有人知道如何解决这个问题?无法安装Hyper-V,也不能安装VirtualBox。 服务器本身是Azure上托管的Windows 10 Technical Preview 3 VM。 Powershell的版本是5.0.10514.0。

2 个答案:

答案 0 :(得分:0)

系统上安装的powershell版本是什么?仅在PS V4上支持Convert-VHD cmdlet。 否则,如果由于某种原因未安装Hyper-V的PS模块,您可以从以下链接下载并导入Hyper-V模块: http://pshyperv.codeplex.com/

答案 1 :(得分:0)

你也可以用 Virtualbox 试试。首先打开一个 Powershell 并转到安装文件夹。

<块引用>

cd "C:\Program Files\Oracle\VirtualBox"

那就试试

<块引用>

.\VBoxManage.exe convertfromraw "C:\Users\username\your\path\file.VHDX" "C:\Users\username\your\path\file.VHD" --format VHD