Function: vRA Machine Get by Name

by Simon Sparks · 3 April 2026

To use this function add it to the class library file named PluginVRAService.ts

GitHub Repository: https://github.com/SimonSparksUK/Orchestrator

Filename: PluginVRAService.ts

Description: Orchestrator Function to Get a Machine by Name

Public Function: MachineGetByName

public MachineGetByName(objVraHost: VraHost, strVraMachineName: string): VraMachine {

    let strXPathQuery: string = `name=${strVraMachineName} or hostname=${strVraMachineName}`;

    let arrVraMachine: VraMachine[] = this.FindAllForType<VraMachine>("Machine", strXPathQuery);

    let objVraMachine: VraMachine = arrVraMachine.find((objVraMachine: VraMachine): boolean => {
        return objVraMachine.name === strVraMachineName || objVraMachine.hostname === strVraMachineName;
    });

    return objVraMachine;
}
TypeScript

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like