2 Replies Latest reply on Oct 19, 2011 8:22 AM by Jeff Schwartzkopf

    Find VMware VM  attributes in a script

      From within an NSH script, I am trying to find the VMware datastore that is hosting a particular VM's primary Disk drive.   I can see this in the console by browsing vSphere server and inspecting.


      "VMware vCenter Server/Virtual Machines/<server name>/Hardware/Disks/Hard disk 1/Disk File"


      Anyone know how to access this bit of information from an NSH script?


      blquery doesn't seem to have any documented virtualization functions.  I have also looked at the BLCLI "Virtualization" namespace, but nothing there seems to get down to this level of detail.

        • 1. Find VMware VM  attributes in a script

          I guess you should get this information by interacting directly with vmWare API.

          • 2. Find VMware VM  attributes in a script

            Yes, powerCLI seems to be the way to get the information.  However, I was trying to create a secondary disk that would be added to the VM post-provisioning.  The secondary disk would be sized based on user input ( CLM ). So this is what I did    


            First I created a component template that contains "Hard Disk 1" and parameterized the path to referenece a local property.  Then the script went something like this...


            1 - Identifiy the vCenter server hosting the VM in question

            2 - Add local property instance to the component template

            3 - Run a discovery on the component template

            4 - Create a BLPackage from the newly discovered component

            5 - Export the BLPackage

            6 - Manipulate the bldeploy.xml file to change the Name of the disk and the VMDK file name

            7 - import the bldeploy.xml file to a new BLPackage

            8 - Deploy the new BLPackage to the vCenter server


            This basically creates a secondary disk on the same VM Datastore that the original VM resides on.