VMware Cloud Community
jamesreinke2
Enthusiast
Enthusiast

convert string to VC:virtualmachine

Is there anyway to convert a string to VC:virtualmachine?

Reply
0 Kudos
4 Replies
iiliev
VMware Employee
VMware Employee

What does this string represent? The name of the virtual machine? If yes, there is a workflow 'Get virtual machines by name' under Library > vCenter > Virtual Machine management > Basic

Note there can be more than one virtual machine matching the given name.

Reply
0 Kudos
jamesreinke2
Enthusiast
Enthusiast

llian,

Your right I did see that but my problem may be uneak. What I want is to have the tenants in vRA only see (a must) their VMs, select that VM and then do what they want with it. My thinking this would be its own workflow that would be placed in front of snapshot or rename workflow for example. Am I going about this the wrong way. Ive had little (very little) training and what training and what Ive had nothing to do with vCenter. Im trying not to reinvent the wheel but did not see anything like this anywhere.  Any help you all can give me is appreciated.

James

Reply
0 Kudos
Uday_Mantri
Enthusiast
Enthusiast

There is a way, suppose you have store your VM name in a string name as an Input and your output is vmname with VC:VirtualMachine type

Input >> string >> name

Output >> VC:VirtualMachine >> vmname

#####Convert String to VC:VirtualMachine type

name = "virtulamachinestringname"

query = "xpath:name='"+name+"'";

name = Server.findAllForType("VC:VirtualMachine", query);

vmname = name[0];

HDaleTAM
VMware Employee
VMware Employee

Providing the code to convert string to VC:VirtualMachine type was VERY HELPFUL to a project I am working on. Worked Perfect! Thanks for sharing!

Reply
0 Kudos