Last active
August 25, 2017 18:08
-
-
Save trisharia/38bdb16255310cdf44d25f7a85b6b165 to your computer and use it in GitHub Desktop.
Get folder of a vCenter VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// VMware vRealize Orchestrator action sample | |
// | |
// Returns the VM folder of a given vCenter VM | |
// | |
// For vRO 7.0+/vCenter 6.0+ | |
// | |
// Action Inputs: | |
// vm - VC:VirtualMachine - vCenter VM | |
// | |
// Return type: VC:VmFolder - the folder to which the VM belongs | |
var parent = vm.parent; | |
while (parent !== null && ! (parent instanceof VcVmFolder)) { | |
parent = parent.parent; | |
} | |
System.log("VcVmFolder of VM: " + parent.name); | |
return parent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment