This commit is contained in:
2023-12-10 13:11:50 -06:00
parent 2237ee043c
commit 25b7e5cd4c
3 changed files with 184 additions and 117 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env pwsh
. /opt/idssys/powerwall/settings.ps1
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
Get-Datastore | Where {$_.Name -like '*iSCSI-*'} | 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