Mike Averto
Mike Averto

Reputation: 665

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?

Upvotes: 5

Views: 3372

Answers (4)

fico7489
fico7489

Reputation: 8560

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

Upvotes: 0

venimus
venimus

Reputation: 6047

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

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

Upvotes: 1

Kamil Szymański
Kamil Szymański

Reputation: 950

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.

Upvotes: 0

Jeff R.
Jeff R.

Reputation: 156

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.

Upvotes: 14

Related Questions