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

This commit is contained in:
2023-12-30 10:04:41 -06:00
parent f5441ed324
commit 5cbea64530

View File

@@ -15,12 +15,20 @@ $ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -P
Do { Do {
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
$poff = 'no'
write-host $VMLIST write-host $VMLIST
if ($VMLIST -ne $null) { if ($VMLIST -ne $null) {
write-host "iscsi vms found" 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 { } else {
write-host "NO iscsi vms found" $poff = 'yes'
}
}
} else {
write-host "no iscsi vms found"
$poff = 'yes' $poff = 'yes'
} }
} Until ($poff -match 'yes') } Until ($poff -match 'yes')