在windows10上的迷走错误与Hyper-V。

时间:2021-10-17 05:50:04

After upgrading to windows 10 then running:

升级到windows10后运行:

$ vagrant up

We get the following error message

我们得到以下错误消息。

An error occurred while executing a PowerShell script. This error
is shown below. Please read the error message and see if this is
a configuration error with your system. If it is not, then please
report a bug.

Script: get_vm_status.ps1
Error:

C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\hyperv\scripts\get_vm_status.ps1 : Unable to
find type [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException].
At line:1 char:1
+ &('C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\prov ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Hyper...FailedException:TypeName) [get_vm_status.ps1], Ru
   ntimeException
    + FullyQualifiedErrorId : TypeNotFound,get_vm_status.ps1

With Vagrant 1.7.4.

1.7.4游民。

Any ideas?

什么好主意吗?

3 个解决方案

#1


14  

I had the same problem on a fresh install of Vagrant 1.7.4 on Windows 10 Enteprise (first time using Vagrant).

我在Windows 10 Enteprise(第一次使用流浪)的时候也遇到了同样的问题。

It looks like the type VirtualizationOperationFailedException has been replaced with VirtualizationException in the latest version of PowerShell.

在最新版本的PowerShell中,类型虚拟化操作failedexception已经被VirtualizationException所取代。

I changed line 15 of C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\hyperv\scripts\get_vm_status.ps1 from:

我修改了第15行C:\HashiCorp\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ !ps1:

} catch [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] {

to

} catch [Microsoft.HyperV.PowerShell.VirtualizationException] {

Now I'm able to use vagrant up and vagrant status without errors. This is obviously not a long term solution but got things working again. There may be other scripts that are broken as well but I haven't run in to them yet.

现在,我可以在没有错误的情况下使用流浪状态和流浪状态。这显然不是一个长期的解决方案,而是让事情重新开始。可能还有其他的脚本也被破坏了,但是我还没有遇到它们。

#2


1  

I had the same error after destroying then recreating a VM.

在销毁了VM之后,我又犯了同样的错误。

I removed the .vagrant/machines/hyperv folder and all went ok.

我删除了.vagrant/machine /hyperv文件夹,一切顺利。

#3


0  

If a solution by @jeff-r doesn't work for you, you can try changing:

如果@ jeffr -r的解决方案对您不起作用,您可以尝试更改:

} catch [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] {

to:

:

} catch [Exception] {

Be careful, it may also cause some side-effects.

小心,它可能也会产生一些副作用。

#1


14  

I had the same problem on a fresh install of Vagrant 1.7.4 on Windows 10 Enteprise (first time using Vagrant).

我在Windows 10 Enteprise(第一次使用流浪)的时候也遇到了同样的问题。

It looks like the type VirtualizationOperationFailedException has been replaced with VirtualizationException in the latest version of PowerShell.

在最新版本的PowerShell中,类型虚拟化操作failedexception已经被VirtualizationException所取代。

I changed line 15 of C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.4\plugins\providers\hyperv\scripts\get_vm_status.ps1 from:

我修改了第15行C:\HashiCorp\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ !ps1:

} catch [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] {

to

} catch [Microsoft.HyperV.PowerShell.VirtualizationException] {

Now I'm able to use vagrant up and vagrant status without errors. This is obviously not a long term solution but got things working again. There may be other scripts that are broken as well but I haven't run in to them yet.

现在,我可以在没有错误的情况下使用流浪状态和流浪状态。这显然不是一个长期的解决方案,而是让事情重新开始。可能还有其他的脚本也被破坏了,但是我还没有遇到它们。

#2


1  

I had the same error after destroying then recreating a VM.

在销毁了VM之后,我又犯了同样的错误。

I removed the .vagrant/machines/hyperv folder and all went ok.

我删除了.vagrant/machine /hyperv文件夹,一切顺利。

#3


0  

If a solution by @jeff-r doesn't work for you, you can try changing:

如果@ jeffr -r的解决方案对您不起作用,您可以尝试更改:

} catch [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException] {

to:

:

} catch [Exception] {

Be careful, it may also cause some side-effects.

小心,它可能也会产生一些副作用。