Skip to content

Instantly share code, notes, and snippets.

@YagmurOzden
YagmurOzden / getAllClusters.js
Last active December 24, 2021 06:15
This action returns all cluster names as string array (VMware vRO action)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: None
//action return type: string (ARRAY)
// this code below gets all clusters
var clusters=VcPlugin.getAllClusterComputeResources();
@YagmurOzden
YagmurOzden / getClustersHost.js
Last active December 24, 2021 06:14
returns a random host belonging to that cluster (VMware vRO action)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: cluster (string, Enter the cluster entry so that the host can be selected)
//action return type: VC:HostSystem
// this code below gets all clusters
var clusters =VcPlugin.getAllClusterComputeResources();
@YagmurOzden
YagmurOzden / getClustersResourcePool.js
Created December 24, 2021 06:19
get the datastore connected to the relevant cluster (VMware vRO action, vSphere, resourcepool)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: cluster (string)
//action return type: VC:ResourcePool (array)
// this code below gets all clusters
var clusters =VcPlugin.getAllClusterComputeResources();
@YagmurOzden
YagmurOzden / getConfigurationElementWhoseTypeIsProperties.js
Created December 24, 2021 06:22
Get configuration element whose type is properties (VMware vRO action, Configuration Element)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: configurationElementName (string), attributeElement(string)
//action return type: Properties
var configurationElementPath = "web-root";
// var configurationElementName = "Catalog Item Credentials";
@YagmurOzden
YagmurOzden / selectRandomVM.js
Created December 24, 2021 06:25
get random VM (VMware vRO action, vSphere, virtual machine)
var vms = VcPlugin.getAllVirtualMachines();
var output = [];
for (var i = 0 ; i < vms.length ; i++){
output.push(vms[i].name);
}
return output[0];
@YagmurOzden
YagmurOzden / timeCalculatingInDateOperations.js
Last active December 24, 2021 06:30
VMware vRO action, vSphere, date time operations, calculating dates
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: date2 (string) , date1 (string)
//action return type: number
//while using this action; time format should be like this: '2021-11-04T08:37:38.273456Z'
var createdAt=date1;
var updatedAt=date2;
@YagmurOzden
YagmurOzden / updateVMAnnotation.js
Created December 24, 2021 06:28
It takes the name of the virtual machine and the values to be entered in the annotation of the virtual machine as string input and updates the annotation in Center (VMware vRO action, vSphere)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: vm (VC:VirtualMachine), newNotes (string)
//action return type: string
if(vm==null){
throw("You have not made an entry for virtual machine");
}
@YagmurOzden
YagmurOzden / setGuestOS.js
Last active December 24, 2021 06:42
VMware vRO workflow, vSphere, GuestOS, VM, Virtual Machine
// VMware vRealize Orchestrator workflow sample
// vRA 8.4
//workflow input type: guestOSName (ARRAY/VC:VirtualMachineGuestOSIdentifier),
// guestOSDescription (ARRAY/string),
// OS (string),
// vmName (string)
//workflow return type: guestOSName (ARRAY/VC:VirtualMachineGuestOSIdentifier)
@YagmurOzden
YagmurOzden / removeSnapshotORSnapshots.js
Created December 24, 2021 06:42
Deletes the selected snapshot or all snapshots in the selected virtual machine. (VMware vRO workflow, vSphere, snapshot, VM, Virtual Machine)
// VMware vRealize Orchestrator action sample
// vRA 8.4
//workflow input type: VM (VC:VirtualMachine)
// snapshotname (string)
// removeAllSnapshotsOfVM
//workflow output type:
@YagmurOzden
YagmurOzden / getVMsCluster.js
Created January 6, 2022 07:25
VMware vRO action, vSphere, Virtual Machine, get virtual machine's cluster
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: vm (VC:VirtualMachine)
//action return type: VC:ClusterComputeResource
var parent = vm.runtime.host;
while (parent !== null && ! (parent instanceof VcClusterComputeResource)) {