Update iscsi-sys-vm-shutdown-verify.ps1
This commit is contained in:
@@ -15,12 +15,20 @@ $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 "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 {
|
||||
$poff = 'yes'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
write-host "NO iscsi vms found"
|
||||
write-host "no iscsi vms found"
|
||||
$poff = 'yes'
|
||||
}
|
||||
} Until ($poff -match 'yes')
|
||||
|
||||
Reference in New Issue
Block a user