update
This commit is contained in:
19
esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1
Executable file
19
esxi-scripts/iscsi-sys-vm-shutdown-verify.ps1
Executable 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!"
|
||||
}
|
||||
}
|
||||
7
esxi-scripts/iscsi-sys-vm-shutdown.ps1
Executable file
7
esxi-scripts/iscsi-sys-vm-shutdown.ps1
Executable 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
|
||||
@@ -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){
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user