Update iscsi-vm-shutdown-verify.ps1
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
#!/usr/bin/env pwsh
|
#!/usr/bin/env pwsh
|
||||||
|
|
||||||
|
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
|
||||||
. /opt/idssys/powerwall/settings.ps1
|
. /opt/idssys/powerwall/settings.ps1
|
||||||
|
|
||||||
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
|
$ESXI = Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
|
||||||
|
|
||||||
Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
|
Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
|
||||||
Try{
|
Try{
|
||||||
@@ -20,3 +21,18 @@ Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM | if ($_.PowerState
|
|||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
|
||||||
|
. /opt/idssys/powerwall/settings.ps1
|
||||||
|
|
||||||
|
$VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM
|
||||||
|
|
||||||
|
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