Quantcast
Channel: Virtual Machine Manager – General forum
Viewing all articles
Browse latest Browse all 2770

Wait for unsaved data in stop-scvirtualmachine PS command?

$
0
0

The HyperV Powershell cmdlet Stop-VM has the -Force parameter. Quoting TechNet:

"Specifies that the shutdown of the virtual machine is to be forced. If the virtual machine has applications with unsaved data, the virtual machine has five minutes to save data and shut down. If the virtual machine is locked, it is shut down immediately."

Can similar behavior be achieved with VMMs Stop-SCVirtualMachine?

This also has a -Force parameter, but I think that just turns off the VM. Quote: "Stop-SCVirtualMachine with theForce parameter stops a virtual machine in the same manner as turning off a computer."

If not directly supported, could I do something like: Stop-SCVirtualMachine -RunAsynchronously -Shutdown and then a loop where I wait a few seconds and the (re)check the state of the vm. And if the vm Status is not "off" after x minutes, then do Stop-SCVirtualMachine -Force? Would that work? I know that is probably harsher than what Stop-VM will do after 5 minutes, but I need to be sure that the vms are off.

And what are the possible values for vm Status? Is that documented anywhere?


Viewing all articles
Browse latest Browse all 2770

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>