+ 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.
15 lines
379 B
PowerShell
15 lines
379 B
PowerShell
Param(
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$VmId,
|
|
[Parameter(Mandatory=$true)]
|
|
[string]$Path
|
|
)
|
|
|
|
$vm = Hyper-V\Get-VM -Id $VmId -ErrorAction "Stop"
|
|
$vm | Hyper-V\Export-VM -Path $Path
|
|
|
|
# Prepare directory structure for box import
|
|
$name = $vm.Name
|
|
Move-Item $Path/$name/* $Path
|
|
Remove-Item -Path $Path/Snapshots -Force -Recurse
|
|
Remove-Item -Path $Path/$name -Force |