VMware {code} Community
tos2k
Expert
Expert

How to create VMX file

Hi!

I do not know the exact relation between information contained by a VMX file, and information of a VM in the vCenter database (or its ESX equivalent).

Is it possible to create a VMX file to a VM, just by using VimSdk to read data from vCenter/ESX database?

If so, how would that be? What information needs to be fetched and written to the VMX file?

Tos2k

0 Kudos
3 Replies
lamw
Community Manager
Community Manager

Majority of the data in the .vmx is accessible via the vSphere API ... the relationship between a virtual machine and the configuration of a virtual machine's .vmx is when a VM is created, an associated set of files including the .vmx is created. So, if you created a VM, you'll get a .vmx and not vice-a-versa.

Here are all the attributes/properties that is available via the vSphere API for a VM: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualMachine.html

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
tos2k
Expert
Expert

Thx, I knew that.

The point is that I need a mapping between all these properties to what really is contained by the VMX file. Not all properties shown in http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.VirtualMachine.html belong to the VMX file.

When you write "majority", what does that mean? Cant VMware provide a detailed spec of what properties I can take from vSphere API, and which i cant?

Tos2k

0 Kudos
lamw
Community Manager
Community Manager

Majority means most but not all ... and no it's not documented Smiley Wink

This script may help answer your question:

Again, it really depends on what you're trying to do or key values you're interested in, but you can go through one of your .vmx and see what you can extract out and using this script you can create a script that reads a list of params and see if you can extract.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos