This commit is contained in:
2023-05-15 10:57:55 -05:00
parent 859588093c
commit bec8780553
2 changed files with 21 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env pwsh
. /opt/idssys/powerwall/settings.ps1
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword
Get-Datastore | Where {$_.Name -like '*iSCSI1*' -or $_.Name -like '*iSCSI2*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
Try{
$vm = Get-VM -Name $vmName -ErrorAction Stop
switch($vm.PowerState){
'poweredon' {
sleep 5
}
}
}
}