【问题标题】:Convert VHDX to VHD (Get-VHD and Convert-VHD are not recognized)将 VHDX 转换为 VHD(无法识别 Get-VHD 和 Convert-VHD)
【发布时间】:2015-10-26 15:45:44
【问题描述】:

我想将一些 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。

【问题讨论】:

  • “无法安装 Hyper-V”是什么意思?如果您有 .vhdx 文件,则 Hyper-V已经安装。
  • 不。上传 VHDX 文件以供进一步处理。场景是这样的:在德国的一个办公室里有一台 Hyper-V 服务器,我在奥地利。德国的公司希望将他们的虚拟机迁移到 Azure,因此他们将 VHDX 文件上传到我用来转换磁盘的服务器,然后在 Azure 上创建虚拟机。此外,存储 VHDX 文件的服务器是 Hyper-V 管理程序(由 Microsoft 管理)中的来宾
  • 此信息与问题完全无关。如果您有一个带有 vhdx 文件的 VM,那么您已经有了 Hyper-V。即使您使用桌面主机,该技术仍然是 Hyper-V。 Convert-VHD 命令在Windows 8 和Windows 10 的RTM 中可用,只要在相应的服务器中即可。
  • 您不是在尝试从虚拟机内部转换 vhdx 文件吗?
  • 不,当然不是。 VHDX 文件已上传到我无法启用 Hyper-V 的虚拟化服务器。 Convert-VHD 命令在此 VM 中不可用,因此我无法转换文件。由于我们讨论的是大约 150GB 的多个文件,因此我不想重新上传它们。

标签: powershell azure vhd


【解决方案1】:

您也可以尝试使用 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

【讨论】:

    【解决方案2】:

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

    更新:

    你需要先启用 hyper-v

    cmd供你参考:

    Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
    

    【讨论】:

    • 我正在运行 PS V5.0.10514.0,由于这是 Hyper-V 中的 VM,我无法安装 Hyper-V。截至目前,我已经找到了如何安装模块,但我现在得到了 Convert-VHD :计算机“SVR”上的操作失败:无效类 At line:1 char:1 + Convert-VHD -Path ”。 \... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo:未指定:(:) [Convert-VHD],VirtualizationException + FullyQualifiedErrorId:未指定,Microsoft.Vhd.PowerShell。 Cmdlets.ConvertVhd 有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多