How can I check if vmFolder or vmResourcePool exist in vSphere? I need it for scripting in vCO.
Something like this:
Check: if vmFolder exist => do nothing and use name of this folder as out parameter.
Thx for comments (sorry my bad english)
vmFolder is a property of a Datacenter and by default, datacenter has 4 folders:- vmFolder, hostFolder, networkFolder and datastoreFolder. You can take input parameter as a datacenter entity and fetch it's vmFolder property.
Regarding how to fetch resourcepool, you can fetch this from ComputeResource entity.
Let me know if this helps or you have any follow up questions.
- Angela -
Thanks for reply, Angela!
In my scripts I use template workflow (Create virtual machine folder). It has 2 input parameters: parentFolder (VC:vmFolder) and name (sting); output parameter is newFolder (VC:vmFoled). So, the script looks like:
newFolder = parentFolder.createFolder(name);
But, can you show me small example how can I fetch parentFolder (Folder "vm" in datacenter) and check existence name of newFolder before creating?