Merge pull request #8568 from chrisroberts/fix/hyperv-import

Update conditional check to use string equality
This commit is contained in:
Chris Roberts 2017-05-08 10:17:35 -07:00 committed by GitHub
commit 8062b4f61f
2 changed files with 7 additions and 7 deletions

View File

@ -10,7 +10,7 @@
[string]$switchname=$null, [string]$switchname=$null,
[string]$memory=$null, [string]$memory=$null,
[string]$maxmemory=$null, [string]$maxmemory=$null,
[string]$cpus=$null, [string]$cpus=$null,
[string]$vmname=$null, [string]$vmname=$null,
[string]$auto_start_action=$null, [string]$auto_start_action=$null,
@ -24,7 +24,7 @@ $Dir = Split-Path $script:MyInvocation.MyCommand.Path
. ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1")) . ([System.IO.Path]::Combine($Dir, "utils\write_messages.ps1"))
$VmProperties = @{ $VmProperties = @{
Path = $vm_config_file Path = $vm_config_file
SnapshotFilePath = Join-Path $data_path 'Snapshots' SnapshotFilePath = Join-Path $data_path 'Snapshots'
VhdDestinationPath = Join-Path $data_path 'Virtual Hard Disks' VhdDestinationPath = Join-Path $data_path 'Virtual Hard Disks'
VirtualMachinePath = $data_path VirtualMachinePath = $data_path
@ -88,7 +88,7 @@ if (!$switchname) {
} }
# Enable nested virtualization if configured # Enable nested virtualization if configured
if ($enable_virtualization_extensions) { if ($enable_virtualization_extensions -eq "True") {
Set-VMProcessor -VM $vmConfig.VM -ExposeVirtualizationExtensions $true Set-VMProcessor -VM $vmConfig.VM -ExposeVirtualizationExtensions $true
} }
@ -139,7 +139,7 @@ if($differencing_disk){
} }
foreach($controller in $controllers){ foreach($controller in $controllers){
foreach($drive in $controller.Drives){ foreach($drive in $controller.Drives){
if([System.IO.Path]::GetFileName($drive.Path) -eq [System.IO.Path]::GetFileName($source_path)){ if([System.IO.Path]::GetFileName($drive.Path) -eq [System.IO.Path]::GetFileName($source_path)){
# Remove the old disk and replace it with a differencing version # Remove the old disk and replace it with a differencing version
$path = $drive.Path $path = $drive.Path

View File

@ -6,7 +6,7 @@ Param(
[string]$switchname=$null, [string]$switchname=$null,
[string]$memory=$null, [string]$memory=$null,
[string]$maxmemory=$null, [string]$maxmemory=$null,
[string]$cpus=$null, [string]$cpus=$null,
[string]$vmname=$null, [string]$vmname=$null,
[string]$auto_start_action=$null, [string]$auto_start_action=$null,
@ -163,7 +163,7 @@ $controllers = Select-Xml -xml $vmconfig -xpath "//*[starts-with(name(.),'contro
# Only set EFI secure boot for Gen 2 machines, not gen 1 # Only set EFI secure boot for Gen 2 machines, not gen 1
if ($generation -ne 1) { if ($generation -ne 1) {
# Set EFI secure boot # Set EFI secure boot
if ($secure_boot_enabled -eq "True") { if ($secure_boot_enabled -eq "True") {
Set-VMFirmware -VM $vm -EnableSecureBoot On Set-VMFirmware -VM $vm -EnableSecureBoot On
} else { } else {
@ -172,7 +172,7 @@ if ($generation -ne 1) {
} }
# Enable nested virtualization if configured # Enable nested virtualization if configured
if ($enable_virtualization_extensions) { if ($enable_virtualization_extensions -eq "True") {
Set-VMProcessor -VM $vm -ExposeVirtualizationExtensions $true Set-VMProcessor -VM $vm -ExposeVirtualizationExtensions $true
} }