I created a new thread for your question.
The problem is most probably caused by the value in the ChangeVersion property.
To avoid duplicate updates to a config, your ChangeVersion property must hold the same value as in the current VirtualMachine object.
Change that line to
$spec.changeVersion = $vmMo.Config.ChangeVersion
Perfect! That worked like a charm. Thanks Luc.
Ok,where is it documented ???
Sorry but i can't understand from the description field(so i have to read all properties) that the error "concurrent modification error" is related to this.
But thanks for your initial reply!
The error you get is a general error.
In the ESXi logs there is probably a much meaningful error message.
In short, setting the ChangeVersion field to "any" value (and not the one that you retrieve from the VM), causes a problem.
The hypervisor uses this to avoid concurrent updates that cancel each other out.
And this is one of the many drawbacks of using Onyx generated code !
It will show the correct value in the property for the run where you used Onyx to capture the method call.
But the Onyx generated code doesn't show where that value came from.
So whenever Onyx gives you code with a static value in there, check the property description to understand what the value, and where it should come from !
Thank you for your reply.Very informative.I have already understand that the code generated from onyx is not a copy-paste issue.But i couldn't believe that this property could cause such a problem.
I would like to ask you if onyx is still under development.Do you have any idea?
Btw you are the first person who provide helpful information in the forums.I don't see a lot of activity in vsphere management sdk forum.
I thought that more people would be active.Anyway.
Since I don't work for VMware I wouldn't know what the future of Onyx might be.
Needless to say that Onyx will not work, in it's current form, with the Web Client.
And since the vSphere Client is apparently destined to disappear, they will have at least to rewrite Onyx or come up with something new.
True, the SDK forum is not very active.
But that doesn't necessarily mean nobody is using the SDK.
Programmers probably use other media to communicate than administrators
I should have chosen to become an admin rather than a programmer.Arghh...Next time
But really i suppose companies should help people who invest in their products.Anyway.
Thanks again you have been very helpful!!!
One more question please.
You wrote "In the ESXi logs there is probably a much meaningful error message."
I would like to ask for access in the logs from our administrators.Can you please tell me the exact directory/filename ?
Sorry but i don't have access to search for this info...
Thanks once again.
You don't need to logon to the ESXi servers to get access to most of the useful logs.
See the Get-Log cmdlet.
Make suer you are connected to the ESXi server (and not the vCenter), then you will be able to get the content of the logs on your system.
Ok thank you.Until now i was searching in the vsphere logs...I have asked for permission to enable ssh so i can search the logs in the esxi servers.