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

This commit is contained in:
2023-12-30 10:22:02 -06:00
parent 8f2b59476c
commit c82ae7c0cb

View File

@@ -6,8 +6,10 @@ Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false | Out
$ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
Do {
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-SYS*'} | Get-VM | Out-Null
write-host $VMLIST
if ($VMLIST -ne $null) {
write-host "cycling through iscsi vms found"
$poff = 'no'
Foreach ($VM in $VMLIST) {
$VMI = Get-VM $VM | Out-Null
@@ -19,8 +21,13 @@ Do {
}
}
} else {
write-host "no iscsi vms found"
$poff = 'yes'
}
} Until ($poff -match 'yes')
Disconnect-VIServer $ESXI -Confirm:$false
Disconnect-VIServer $ESXI -Confirm:$false | Out-Null