Winners of the VMware Script-O-Mania Contest: Who, What, How and Why?

The winners of the VMware Script-O-Mania contest was announced today by Pablo Roesch at VMware Developer Blog. Congratulations to Alan, William and Arnim who won the first three awards!

I just took some time to read these scripts even though PowerShell and Perl are not for me. Here I give you a brief introduction of the scripts, what vSphere APIs they used directly or indirectly, and why they topped the contest. Because vSphere API is based on Web Services, you can port the scripts to other languages like Java, .Net, whatever you feel comfortable with. If you want to port any of them using vSphere Java API, I am more than happy to include your contribution.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

Note that the following comments are strictly my own opinions.

1. Who Created that VM ? – by Alan Renouf using PowerCLI

A script to add information back into the vSphere client, this script which is designed to run once a day (or more) as a scheduled task, will add a custom attribute to each VM with the creator and date created of that VM. A script to add information back into the vSphere client, this script which is designed to run once a day (or more) as a scheduled task, will add a custom attribute to each VM with the creator and date created of that VM.

Steve’s Comments:

Nice integration with the vSphere Client, making you almost doubt why it wasn’t there in the first place. Additional one liner scripts provide nice answers to the questions like who created the most VMs, how many VMs were created each month.

Technically, it used vSphere APIs indirectly to retrieve events like “VmBeingDeployedEvent”, “VmCreatedEvent”,”VmRegisteredEvent”, “VmClonedEvent”, and tag the VMs using the customFields. The Managed Objects involved are: VirtualMachine, EventHistoryCollector, CustomFieldsManager.

More details are here.

2. vAppManagement – by William Lam, VI Perl

The script allows for general vApp management supporting the following operations: querying for the VMs within a vApp, powering on a vApp, powering off a vApp, shutting down a vApp, querying for snapshots for VMs in the vApp, creating a common snapshot for each VM in the vApp, committing a common snapshot for each Vm in the vApp and goto (revert) to a common snapshot for each VM in the vApp.

Steve’s Comments:

Rich in features that cover many aspects running the vApp in vSphere. It complements well with the VMware OVF tools.

The scripts is the longest among the top 3. With different commands, the execution paths could be different. The managed objects involved include: VirtualApp, VirtualMachine, VirtualMachineSnapshot.

More details are here.

3. Get-VMDiskMapping by Arnim V Lieshout, PowerCLI

Most probably you were asked by the server administrator or dba to extend Windows disk number x. Unfortunately this Windows disk number doesn’t correspond to the virtual disk number of your VM. Finding out which virtual disk in the VM’s settings corresponds to this Windows disk can be a cumbersome task. Especially when you have multiple SCSI controllers and/or many disks attached to your VM.

This script matches Windows disks and their VMware virtual disk counterparts. It uses the Invoke-VMScript cmdlet to retrieve WMI information from the Windows guest, so there is no network connection needed to the VM. This makes the script suitable for isolated guests too (Internal only network, DMZ, or otherwise separated by firewall).

Multiple vCenter- or ESX(i)-servers can be added to the $VCServerList array, so there’s no need to know which host or vCenter manages your VM.

Steve’s Comments:

This script bridges the gap between the hypervisor and the Windows guest OS’s views to storage with the nice mapping. It also leverages the real strength of PowerShell – the ability integrating with other components beyond VMware.

The script runs VMI command using Invoke-VMScript (via VIX?), then retrieves the related info from hypervisor. In the end, it matches disks based on Controller and SCSI ID. The managed objects include: VirtualMachine, HostSystem

More details are here.

To be notified for future posts, feel free to subscribe to this feed, and follow me at Twitter.

This entry was posted in News & Events, vSphere API and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.