Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant Error on Windows 10 with Hyper-V

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?

like image 642
Mike Averto Avatar asked Aug 03 '15 14:08

Mike Averto


2 Answers

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.

like image 92
Jeff R. Avatar answered Sep 23 '22 22:09

Jeff R.


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

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

like image 41
venimus Avatar answered Sep 26 '22 22:09

venimus