Vagrant Error in Windows 10 with Hyper-V

After upgrading to Windows 10, do:

$ 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.

Any ideas?

+5
source share
3 answers

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

It appears that the type of VirtualizationOperationFailedException has been replaced by VirtualizationException in the latest version of PowerShell.

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

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

to

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

Now I can use vagrant and vagrant status without errors. This is obviously not a long-term solution, but everything works again. There may be other scripts that are also broken, but I have not come to them yet.

+14
source

I had the same error after destroying and then re-creating the virtual machine.

I deleted the .vagrant/machines/hyperv and everything went fine.

+1
source

If @ jeff-r's solution does not work for you, you can try:

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

in

 } catch [Exception] { 

Be careful, this can also cause some side effects.

0
source

All Articles