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.
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:
Please log in to answer
Posted by:
rileyz
8 years ago
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.
- 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. - Loop the object to shut them down.
- Check that all VMs are down then upgrade.