From 75116664f40854ab0ce8511139302af40b6cf51d Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 30 Dec 2023 09:34:33 -0600 Subject: [PATCH] Update iscsi-sys-vm-shutdown-verify.ps1 --- esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 b/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 index 3e25e34f..c563d5a8 100755 --- a/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 +++ b/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 @@ -14,13 +14,15 @@ $ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -P # } Do { - $poff = 'no' $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM write-host $VMLIST if ($VMLIST -ne '') { - write-host "cycling thoruygh iscsi vms found" + write-host "cycling through iscsi vms found" + $poff = 'no' Foreach ($VM in $VMLIST) { - if ((Get-VM $VM).PowerState -notmatch 'PoweredOn') { + if ((Get-VM $VM).PowerState -match 'PoweredOn') { + break + } else { $poff = 'yes' } }