Vagrant Error on Windows 10 with Hyper-V
Asked Answered
H

4

5

After upgrading to windows 10 then running:

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

Hermeneutics answered 3/8, 2015 at 14:34 Comment(2)
Windows 10 is having some problems with Hyper-V. Can you create a new VM from the Hyper-V Manager and try to start it?Kekkonen
I've just had the same error. The strange thing is, I didn't originally. I haven't installed any updates for vagrant, hyper-v, Windows, WMF/PowerShell, etc. I haven't even rebooted since the last time I successfully used vagrant; I was even using the same command prompt. So weird.Dingess
S
14

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

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

I changed line 15 of 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'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.

Stalagmite answered 7/8, 2015 at 19:55 Comment(1)
I also experienced this with Vagrant 1.7.2 and this fix worked for that too, use the path from your error to get the correct location of get_vm_status.ps1Whitelaw
F
1

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

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

Freedman answered 11/4, 2016 at 13:4 Comment(0)
M
0

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

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

to:

} catch [Exception] {

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

Mcculley answered 17/10, 2015 at 22:46 Comment(0)
B
0

on win 10 you must disable "Hyper-V" to run vagrant/virtualbox

Banket answered 24/12, 2018 at 12:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.