virtual grind thoughts from the virtual world


Using PowerCLI To Answer All CD-ROM Override Questions

I recently ran in to a scenario where multiple cd-rom drives were disconnected from 100's of virtual machines and there were questions generated for each. In order to quickly answer and clear the questions, you can simply use this one liner after connecting to vCenter (Connect-VIServer):

Get-VM | Get-VMQuestion | Set-VMQuestion -Option "Yes" -Confirm:$false

Note than the "-Confirm:$false" will not prompt you as the script runs, taking care of each question automatically. If you would rather see each confirmation, you can remove the the Confirm switch.


Using PowerCLI to Answer VM Questions

I recently have been testing some vendor's storage solutions and fast provisioning in vCloud Director. During the testing, I create a load simulator to mimic 1000 virtual machines inflating disks, testing write patterns, etc. In any case, during the testing, I was able to completely obliterate the vendor's write cache and write IOPS, causing datastore issues. This also caused 1000 virtual machines to get stalled due to datastores being filled up, and having a question placed on them.

In order to quickly answer these 1000 questions, this PowerCLI example worked like a charm:

Get-VM LoadTest* | Get-VMQuestion | Set-VMQuestion --Option "Cancel"

In this example, I wanted to answer "Cancel" on all VM's connected named LoadTest*


Using vim-cmd to Power On and Power Off Virtual Machines

To get a list of all virtual machines on a host:

vim-cmd vmsvc/getallvms

To power on a specific virtual machine (from above):

vim-cmd vmsvc/power.on vmnumber

To power off a specific virtual machine (from above):

vim-cmd vmsvc/ vmnumber


VMware’s Project Onyx

I just discovered an alpha release of a great new automation tool dubbed "Project Onyx".

From the project page:

"Project Onyx is a new tool in that generates code based on the mouse clicks you make in the vSphere Client. Project Onyx makes it easy to see what is happening behind the covers and can help with development of scripts and automation solutions. Please refer to the Using Project Onyx video for set up and more information."

Setting up the tool is very easy and it looks like the tool proxies a connection to ESX/VC from your local machine. From there, regular tasks can be performed in your VSphere Client then captured by Onyx. The resulting Powershell script can than be copied and edited to suit your needs. This is great stuff.

You can read more about Onyx here.