Vagrant: Vagrant up fail with Hyper-V

Created on 19 Jul 2017  ·  9Comments  ·  Source: hashicorp/vagrant

Vagrant version

1.9.7

Host operating system

Windows 10 (french version)

Guest operating system

gusztavvargadr/w10e

Vagrantfile

Vagrant.configure("2") do |config|
    Vagrant.require_version ">= 1.9.7"
    config.vm.provider "hyperv"
    config.vm.box = "gusztavvargadr/w10e"
end

Expected behavior

I expect a new VM.

Actual behavior

I get this error:

F:>vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Configured startup memory is 1024
==> default: Configured cpus number is 1
==> default: Importing a Hyper-V instance
default: Cloning virtual hard drive...
default: Creating and registering the VM...
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: import_vm_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V n'a trouvé aucun commutateur virtuel
portant le nom « Pour Accès Externe ».
Au caractère C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.7\plugins\prov
iders\hyperv\scripts\import_vm_vmcx.ps1:96 : 1

  • Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : InvalidArgument : (:) [Connect-VMNetworkAdapter]

      , VirtualizationException

    • FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Com

      mands.ConnectVMNetworkAdapter

But i get this commutator "Pour Accès Externe", into Hyper-V.
I suspect, it's due to "è" (seen like this into Hyper-V), but become "è" with Vagrant.

Steps to reproduce

  1. Vagrant up (only), maybe onto a French Windows Host.

References

No

encoding hoswindows providehyperv

Most helpful comment

@AlexRadch Create a new "virtual switch" (виртуальный коммутатор) in Hyper-V Manager with an english name like "Default Virtual Switch" with the same options then retry vagrant up

All 9 comments

Hello,
I confirm this issue relates to the accentuated e: if we create a new commutator with no special character it works.

Confirmed. Seems to be an encoding issue.

> vagrant up
Bringing machine 'homestead-7' up with 'hyperv' provider...
==> homestead-7: Verifying Hyper-V is enabled...
==> homestead-7: Importing a Hyper-V instance
    homestead-7: Please choose a switch to attach to your Hyper-V instance.
    homestead-7: If none of these are appropriate, please open the Hyper-V manager
    homestead-7: to create a new virtual switch.
    homestead-7:
    homestead-7: 1) DockerNAT
    homestead-7: 2) Commutateur par défaut
    homestead-7:
    homestead-7: What switch would you like to use? 2
    homestead-7: Cloning virtual hard drive...
    homestead-7: Creating and registering the VM...
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: import_vm_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V n'a trouvé aucun commutateur virtuel portant le nom « Commutateur par défaut ».
Au caractère C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-2.0.1\plugins\providers\hyperv\scripts\import_vm_vmcx.ps1:96 : 1
+ Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument : (:) [Connect-VMNetworkAdapter], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.ConnectVMNetworkAdapter

I have the same issue with laravel/homestead guest OS on Russian Windows 10 Host

Bringing machine 'homestead-7' up with 'hyperv' provider...
==> homestead-7: Verifying Hyper-V is enabled...
==> homestead-7: Importing a Hyper-V instance
    homestead-7: Cloning virtual hard drive...
    homestead-7: Creating and registering the VM...
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: import_vm_vmcx.ps1
Error:

Connect-VMNetworkAdapter : Hyper-V не удалось найти виртуальный коммутатор с именем "Р?Р?Р?Р?С?С".
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-2.0.1\plugins\providers\hyperv\scripts\import_vm_vmcx.ps1:96 знак:1
+ Connect-VMNetworkAdapter -VMNetworkAdapter $vmNetworkAdapter -SwitchN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Connect-VMNetworkAdapter], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.ConnectVMNetworkAdapter

How to workaround this?

@AlexRadch Create a new "virtual switch" (виртуальный коммутатор) in Hyper-V Manager with an english name like "Default Virtual Switch" with the same options then retry vagrant up

@Prometee yes it works.

Hi there,

It looks like this has been resolved within a previously shipped version of Vagrant so I am now closing this issue. If the original issue was not fully resolved, please reopen this issue or create a new one.

Cheers!

I'm on 2.2.7 and I still get this error:

==> slave2: Starting the machine...
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: start_vm.ps1
Error:

Hi @jospradlin,

Sorry that you're seeing this error when bringing up a VM. I see that your error is in the start_vm.ps1 script, and the original issue mentioned the import_vm_vmcx.ps1 script. Would you be willing to open up a new issue and fill out the issue template so we can investigate?

Cheers! 😄

I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings