Answer the question
In order to leave comments, you need to log in
How to enable/disable a VM in a cluster via Powershell?
I'm trying to turn off several (not all) virtual machines on two Hyper-V clusters from a remote machine, by a certain event, and then turn them on by another event. The event is the status of the UPS.
The shutdown script is as follows:
$cluster01 = New-PSSession -ComputerName "hv-02"
Invoke-Command -Session $cluster01 -ScriptBlock {
Get-ClusterGroup -Name VM-01 | Stop-VM
Get-ClusterGroup -Name VM-02 | Stop-VM
}
$cluster02 = New-PSSession -ComputerName "hv-06"
Invoke-Command -Session $cluster02 -ScriptBlock {
Get-ClusterGroup -Name VM-03 | Stop-VM
Get-ClusterGroup -Name VM-04 | Stop-VM
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question