Update iscsi-sys-vm-shutdown-verify.ps1
This commit is contained in:
1 parent
d330892f4e
commit
32532d1bd5
1 file changed
+20
-6
@@ -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