Update iscsi-sys-vm-shutdown-verify.ps1
This commit is contained in:
@@ -5,12 +5,26 @@
|
||||
|
||||
$ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
|
||||
|
||||
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
|
||||
# $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
|
||||
#
|
||||
# Foreach ($VM in $VMLIST) {
|
||||
# while((Get-VM $VM).PowerState -ne 'PoweredOff') {
|
||||
# Start-Sleep -Seconds 1
|
||||
# }
|
||||
# }
|
||||
|
||||
Do {
|
||||
$poff = yes
|
||||
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
|
||||
Foreach ($VM in $VMLIST) {
|
||||
if ((Get-VM $VM).PowerState -eq 'PoweredOn') {
|
||||
$poff = no
|
||||
}
|
||||
}
|
||||
} Until ($poff -eq yes)
|
||||
|
||||
|
||||
|
||||
|
||||
Foreach ($VM in $VMLIST) {
|
||||
while((Get-VM $VM).PowerState -ne 'PoweredOff') {
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
}
|
||||
|
||||
Disconnect-VIServer $ESXI -Confirm:$false
|
||||
Reference in New Issue
Block a user