+ This disambuguates calls to the Hyper-V functions for the Hyper-V provider.
The ambiguity of some commands - such as `Get-VM` - causes the Hyper-V provider
to fail on systems where VMware PowerCLI is installed. This change ensures that
all calls to Hyper-V specific cmdlets or functions are prepended by `Hyper-V\`.
This ensures the correct cmdlet calls are being made.
+ Resolves #8862.
Powershell helper script now returns error when guest IP address
cannot be discovered. When reading addresses from a network
device both IPv4 and IPv6 are stored and the IPv4 address has
precedence on returned address.
This makes the behavior of the docker and hyperv provider consistent with the
virtualbox provider by raising an error on ssh actions if the machine is not
created or not running.
Fixes#8508
Fix the error
```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:
At C:\Program Files
(x86)\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.4\plugins\providers\hyper v\scripts\import_vm_vmcx.ps1:18 char:37
+ [string]$differencing_disk=$null
+ ~
Missing ')' in function parameter list.
At C:\Program Files
(x86)\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.9.4\plugins\providers\hyper v\scripts\import_vm_vmcx.ps1:20 char:1
+ )
+ ~
Unexpected token ')' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : MissingEndParenthesisInFunctionParameterList
```
It was failing to create files below the machines\default\hyperv folder, rather it was creating folders named 'hypervSnapshots', 'hypervVirtual Hard Disks', and 'hypervVirtual Machines'. This was causing the files to not be removed when destroying the vm, and an error when subsequently bringing it up again.
Implemented the differencing disk for vmcx.
This means the disk is now copied by Hyper-V (Powershell) instead of Ruby for new machines.
This does mean EFI Firmware now does work for machines since it is quite a feep copy. Compare-VM will report incompatibilities should they be found.
Use the version of Hyper-V instead of Powershell to determine which
exception is thrown by Get-VM. Also fixing an invalid catch statement,
since Powershell can not use variables to match thrown exceptions in
catch.
Previously, there was no one gesture that would start a VM if it was not
running and run the appropriate provisioners regardless of its original
state. `vagrant up` did nothing if the VM was running, while
`vagrant provision` did nothing if the VM was not running.
Change the semantics of `vagrant up`, via the start actions of the providers,
to go through the provisioning logic even if the VM is already running.
The semantics of `run: "once"` vs `run: "always"` are respected.
Tested with the VirtualBox provider but not the others.
Resolves#4421