VMware {code} Community
RockyConcept
Contributor
Contributor
Jump to solution

Editing .VMX file through code

Hi,

I am not sure VIX API is the right forum to ask this question. Since VIX API helps to do most of guest operations, I dare to ask here.

I work with VMware Workstation and I am looking for a programatic way to edit the .VMX file and do some chages.

I want to change the SnapshotAction, VM name, WorkingDir configuration by programatic way. Do VIX API will help me to do this or I need to use any other SDK. If possible, please direct me with sample.

Thanks in advance...

Rocky

Reply
0 Kudos
1 Solution

Accepted Solutions
admin
Immortal
Immortal
Jump to solution

I believe the original post was about Workstation.

If ESX/vSphere is an option, there are a number of APIs, including the PowerCLI, as well as vSphere SDKs for Perl and Java.

View solution in original post

Reply
0 Kudos
8 Replies
SoMoS
Contributor
Contributor
Jump to solution

As far as I know VIX does not provide methods to do that kind of operations. I've been using VIX for a while and I never saw something like that. You can check here the methods available:

http://www.vmware.com/support/developer/vix-api/vix16_reference/

Reply
0 Kudos
tos2k
Expert
Expert
Jump to solution

Hi!

Why dont you open the vmx file, read it, change it, and write it back?

Tos2k

Reply
0 Kudos
verminator
Enthusiast
Enthusiast
Jump to solution

I suppose it depends. If the vmx file is hosted on an ESX server, I don't think you can directly open it for writing via C or Java I/O operation.

However, if the VM is on a local machine, and being run using VMWare workstation, or any local client, then its fairly trivial to open/read/write/close from your code via the I/O API of the language you're using.

Reply
0 Kudos
tos2k
Expert
Expert
Jump to solution

Yes, vmx files on ESX hosts can be dowloaded, opened, written, and uploaded back in general.

Of course, changes in vmx wont affect on ESX/vCenter before reregistration of VM.

Tos2k

Reply
0 Kudos
RockyConcept
Contributor
Contributor
Jump to solution

Thanks for your comments....

Yes, I understand that I can 'manually' download vmx,  edit it in notepad/wordpad and reregister it for effect. But my question is there any SDK or set of classes that I can use to edit the VMX file.

your comments would be really helpful.....Thanks in advance.....

Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

There is currently no API available for VMware Workstation to let you programmatically change those values.

Reply
0 Kudos
jose_maria_gonz
Virtuoso
Virtuoso
Jump to solution

Hi RockyConcept,

Have you tried with PowerShell? It is a quite nice way to script changes within your vms.

Jose Maria Gonzalez
Author of 101 Secretos de VMware vSphere
VCI, VCP4, VCP3, VCP2, RHCE, MCSE, vExpert 2009, 2010
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

I believe the original post was about Workstation.

If ESX/vSphere is an option, there are a number of APIs, including the PowerCLI, as well as vSphere SDKs for Perl and Java.

Reply
0 Kudos