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?

Mike Averto
  • 655
  • 1
  • 10
  • 16
  • 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? – juliano.net Aug 03 '15 at 19:56
  • 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. – briantist Nov 07 '15 at 23:31

4 Answers4

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.

Jeff R.
  • 156
  • 1
  • 2
  • 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.ps1 – Tisch Feb 23 '16 at 22:49
1

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

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

venimus
  • 5,907
  • 2
  • 28
  • 38
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.

Kamil Szymański
  • 950
  • 12
  • 26
0

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

fico7489
  • 7,931
  • 7
  • 55
  • 89