From 9fd635742c998df7e453ea4d14651b0aa6466b9f Mon Sep 17 00:00:00 2001 From: Taliesin Sisson Date: Tue, 27 Oct 2015 00:12:41 +0000 Subject: [PATCH] Always force turn off vm --- powershell/hyperv/hyperv.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/powershell/hyperv/hyperv.go b/powershell/hyperv/hyperv.go index 0b5d14869..3cf5d8a38 100644 --- a/powershell/hyperv/hyperv.go +++ b/powershell/hyperv/hyperv.go @@ -273,7 +273,7 @@ func StopVirtualMachine(vmName string) error { param([string]$vmName) $vm = Get-VM -Name $vmName if ($vm.State -eq [Microsoft.HyperV.PowerShell.VMState]::Running) { - Stop-VM -VM $vm -Confirm:$false + Stop-VM -VM $vm -Force -Confirm:$false } ` @@ -477,7 +477,7 @@ func TurnOff(vmName string) error { param([string]$vmName) $vm = Get-VM -Name $vmName -ErrorAction SilentlyContinue if ($vm.State -eq [Microsoft.HyperV.PowerShell.VMState]::Running) { - Stop-VM -Name $vmName -TurnOff -Confirm:$false -Force + Stop-VM -Name $vmName -TurnOff -Force -Confirm:$false } ` @@ -492,7 +492,7 @@ func ShutDown(vmName string) error { param([string]$vmName) $vm = Get-VM -Name $vmName -ErrorAction SilentlyContinue if ($vm.State -eq [Microsoft.HyperV.PowerShell.VMState]::Running) { - Stop-VM -Name $vmName -Confirm:$false -Force + Stop-VM -Name $vmName -Force -Confirm:$false } `