Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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)) {
@YagmurOzden
YagmurOzden / numberOfRepetitionsAsProp.js
Created January 6, 2022 07:33
This action creates properties about which catalogue item used how many times. | VMware vRO action, vSphere, Configuration Element
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: none
//action return type: Properties
var deployment = System.getModule("<your-path-name>").getConfigurationElementWhoseTypeIsProperties("Catalog Item Credentials","deployment");
var catalogItems =System.getModule("<your-path-name>").getConfigurationElementWhoseTypeIsProperties("Catalog Item Credentials","catalogItems");