Update iscsi-sys-vm-shutdown-verify.ps1

This commit is contained in:
2023-12-30 09:34:33 -06:00
parent cf3f3660b5
commit 75116664f4

View File

@@ -14,13 +14,15 @@ $ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -P
# } # }
Do { Do {
$poff = 'no'
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
write-host $VMLIST write-host $VMLIST
if ($VMLIST -ne '') { if ($VMLIST -ne '') {
write-host "cycling thoruygh iscsi vms found" write-host "cycling through iscsi vms found"
$poff = 'no'
Foreach ($VM in $VMLIST) { Foreach ($VM in $VMLIST) {
if ((Get-VM $VM).PowerState -notmatch 'PoweredOn') { if ((Get-VM $VM).PowerState -match 'PoweredOn') {
break
} else {
$poff = 'yes' $poff = 'yes'
} }
} }