We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allows to perform operations such as start, stop or save VMs
The text was updated successfully, but these errors were encountered:
I've found that it can be done using PowerShell, but I just don't know how to do that in Go. 🤔
It should be able to change the VM state by invoking the RequestStateChange method of the Msvm_ComputerSystem class that represents the VM.
RequestStateChange
Msvm_ComputerSystem
Msvm_ComputerSystem.RequestStateChange
# PowerShell (Administrator) > Get-VM -Name debian Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version ---- ----- ----------- ----------------- ------ ------ ------- Debian Off 0 0 00:00:00 正常稼働中 10.0 > $enable = 2 > $disable = 3 > Get-CimInstance -Namespace root/virtualization/v2 -ClassName Msvm_ComputerSystem | ? ElementName -eq "Debian" | Invoke-CimMethod -MethodName "RequestStateChange" -Arguments @{RequestedState = 2} Job ReturnValue PSComputerName --- ----------- -------------- Msvm_ConcreteJob (InstanceID = "6E69C4C8-0A89-4857-8E85-C9CC77A78BD1") 4096 > Get-VM -Name Debian Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version ---- ----- ----------- ----------------- ------ ------ ------- Debian Running 0 1024 00:00:50.8140000 正常稼働中 10.0
Sorry, something went wrong.
No branches or pull requests
Allows to perform operations such as start, stop or save VMs
The text was updated successfully, but these errors were encountered: