Update iscsi-vm-shutdown-verify.ps1
This commit is contained in:
@@ -1,29 +1,5 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
|
||||
. /opt/idssys/powerwall/settings.ps1
|
||||
|
||||
$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") {
|
||||
Try{
|
||||
$vm = Get-VM -Name $vmName -ErrorAction Stop
|
||||
switch($vm.PowerState){
|
||||
'poweredon' {
|
||||
sleep 5
|
||||
}
|
||||
}
|
||||
}
|
||||
Catch{
|
||||
Write-Host "VM '$($vmName)' not found!"
|
||||
}
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false
|
||||
. /opt/idssys/powerwall/settings.ps1
|
||||
|
||||
@@ -31,6 +7,7 @@ $VMLIST = Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM
|
||||
|
||||
Foreach ($VM in $VMLIST) {
|
||||
while((Get-VM $VM).PowerState -ne 'PoweredOff') {
|
||||
write-host waiting
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user