From f5441ed324d2565c36a587a96d5919669828c482 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 30 Dec 2023 10:03:21 -0600 Subject: [PATCH] Update iscsi-sys-vm-shutdown-verify.ps1 --- esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1 | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) 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')