VMware Cloud Community
MaikStuebner
Contributor
Contributor
Jump to solution

How set vm-description/notes and get datastore name, where the vm is located

Hello guys,
I have vCenter Orchestrator 4.1.1 build 733 installed and it works fine, but I need your help for the two following problems:
1)    I want to set the description/notes of a vm by using a workflow. But I didn’t found any helpful API to create such a workflow (I don’t mean the custom attributes, see attachment for more details).

2)    How can I get the name of the datastore, where the vm is located? I need this name for a workflow.
I need your help.
Thanks in advance!

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

In regards to the VM notes, the following code (see attached package) can do that:

var oldNotes = vm.summary.config.annotation;
if (oldNotes == null){oldNotes = "";}
System.log("Current VM Notes: "+oldNotes);
// Now set the new Notes:
// Start by creating a ConfigSpec
var configSpec = new VcVirtualMachineConfigSpec();
// Update the annotation property with new value
configSpec.annotation = notes;
// launch task to reconfig the vm with the new configspec
// NOTE: This is safe to apply with powered on VM
var task = vm.reconfigVM_Task(configSpec);

And, in regards to VM information, take a look at the Library workflow: \Library\vCenter\Virtual Machine management\Others\Extract virtual machine information

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
2 Replies
Burke-
VMware Employee
VMware Employee
Jump to solution

In regards to the VM notes, the following code (see attached package) can do that:

var oldNotes = vm.summary.config.annotation;
if (oldNotes == null){oldNotes = "";}
System.log("Current VM Notes: "+oldNotes);
// Now set the new Notes:
// Start by creating a ConfigSpec
var configSpec = new VcVirtualMachineConfigSpec();
// Update the annotation property with new value
configSpec.annotation = notes;
// launch task to reconfig the vm with the new configspec
// NOTE: This is safe to apply with powered on VM
var task = vm.reconfigVM_Task(configSpec);

And, in regards to VM information, take a look at the Library workflow: \Library\vCenter\Virtual Machine management\Others\Extract virtual machine information

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos
svenherren
Enthusiast
Enthusiast
Jump to solution

Hi everybody,

the solution here works fine for the notes: section in annotations.

And how is it possible to get/set the other annotations that can be defined individually.


Regards

Sven

0 Kudos