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!"
}
}

View File

@@ -0,0 +1,7 @@
#!/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 | Where {$_.PowerState -like '*On*' -and $_.Name -notlike '*CLS*'} | Shutdown-VMGuest -Confirm:$false

View File

@@ -4,7 +4,7 @@
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*' -or $_.Name -like '*iSCSI2*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
Get-Datastore | Where {$_.Name -like '*iSCSI-PRI*'} | Get-VM | if ($_.PowerState -eq "PoweredOn") {
Try{
$vm = Get-VM -Name $vmName -ErrorAction Stop
switch($vm.PowerState){

View File

@@ -4,4 +4,4 @@
Connect-VIServer -Server $args[0] -Protocol https -User $ESXiUsername -Password $ESXiPassword | Out-Null
Get-VM | Where {$_.PowerState -like '*On*' -and ($_.Name -like '*MySQL*' -or $_.Name -like '*PiHole*' -or $_.Name -like '*vCenter*')} | Suspend-VM -Confirm:$false
Get-VM | Where {$_.PowerState -like '*On*' -and ($_.Name -like '*MySQL-Node*' -or $_.Name -like '*LAN-DNS*')} | Suspend-VM -Confirm:$false