This commit is contained in:
2023-10-25 08:45:25 -05:00
parent ea70de6fbf
commit 5cc55c8ecf
6 changed files with 49 additions and 10 deletions

View File

@@ -0,0 +1,19 @@
#!/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-SYS*'} | 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!"
}
}