diff --git a/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 b/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 index 0abba8d1..fe569960 100755 --- a/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 +++ b/esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 @@ -15,20 +15,12 @@ $ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -P Do { $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM + $poff = 'no' write-host $VMLIST if ($VMLIST -ne $null) { - write-host "cycling through iscsi vms found" - $poff = 'no' - Foreach ($VM in $VMLIST) { - $VMI = Get-VM $VM - if ($VMI -eq $null -Or $VMI.PowerState -match 'PoweredOn') { - break - } else { - $poff = 'yes' - } - } + write-host "iscsi vms found" } else { - write-host "no iscsi vms found" + write-host "NO iscsi vms found" $poff = 'yes' } } Until ($poff -match 'yes')