Virtualization Pro

Jan 14 2008   4:23AM GMT

Printing a VI server’s inventory

Kutz Profile: Akutz

Here is a quick Perl script I wrote to print out your VI server’s (VC or ESX) inventory. I know what you’re thinking, “Um, aren’t there already examples that do this?” Yes and no. See, most examples you find, including VMware’s own, will print out all the VMs or the VI hierarchy as defined by the SDK. My script prints out the inventory based on the hierarchy that is displayed in the VI client. Here is some example output:

[0]akutz@amends:$ --server --username akutz --password mypassword 
[Folder] foo 
  [Datacenter] foo_dc 
[Datacenter] austin 
  [ClusterComputeResource] garage 
    [ResourcePool] coldair 
      [ResourcePool] hotair 
        [ResourcePool] rp2 
        [VirtualMachine] purple.lostcreations.local1 
      [ResourcePool] wheel 
        [ResourcePool] rp3 
    [ResourcePool] rp4 
    [HostSystem] mandy.lostcreations.local 
    [HostSystem] morning.lostcreations.local

The printinventory script, and others, can be found on my web site or you can browse directly to the printinventory code view.

Why should the inventory you see be any different that what the VI client shows you? Sometimes it is helpful to be able to produce the same output as another program. Especially if you’re attempting to mimic that program’s functionality. Coming up, ivi.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: