How to safely shutdown multiple VirtualBox machines using command line

Hi all.

I am new here at ITNinja and would need your help with scripting issue:

I have been requested to deploy the latest version of VirtualBox to customer computers (about 100 Win7 PCs) via SCCM.
These computers already have VirtualBox installed.
The customer asked if the installation script could safely shutdown all open VirtualBox machines before the updating starts and
this way avoid any possible data loss.

I tried to check VBoxManage commands from http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm but not sure how this could be done.

My guess is that the script should first list all currently running virtual machines and store this information to a some file.
Then this information (machine name / identifier) should be used with a command that closes running virtual machines one at the time.

Does this make any sense :) Or is there some other way to do this?

Thanks in advance.

0 Comments   [ + ] Show comments

Answers (1)

Answer Summary:
Posted by: rileyz 6 years ago
Red Belt

Top Answer

Firstly, I don't think as SCCM admin you should be managing users VMs, if they are using a VM then they fall into the Dev category and are grown up enough to manage their own VMs pre upgrade. Its basicly like me asking you to do my job cos Im a lazy git.

What you should do is use the command to list running VMs then halt the deployment if it finds any running VMs, leave it up to the owner of the VM to shut them down. Thinking about using PSDeploy as they can toast user notifications to users etc.

Good luck!

PS if you want to do this is powershell.
  1. List the running VMs and pump that into an array object.
    Bash the array around if you need ie to split the name and UUID.
  2. Loop the object to shut them down.
  3. Check that all VMs are down then upgrade.

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ