Skip to content

Instantly share code, notes, and snippets.

@mccbryan3
Last active May 16, 2020 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mccbryan3/53c863acfc33f960296e722531e9d810 to your computer and use it in GitHub Desktop.
Save mccbryan3/53c863acfc33f960296e722531e9d810 to your computer and use it in GitHub Desktop.
This will take a VM input and search all vcenters added to vro and load the VC:Vm and VC:SdkConnection into output variables
var reg = new RegExp("^"+ strVmName + "$", 'ig');
for each(vm in VcPlugin.getAllVirtualMachines(null,"xpath:name='" + strVmName + "'")) {
if(vm.name.match(reg)) {
vcenterSdk = vm.sdkConnection
vmOut = vm
System.log(vmOut.summary)
System.log(vcenterSdk)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment