Function: vCenter Virtual Machine Get All Virtual Devices by Type

by Simon Sparks · 2 February 2026

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

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

Filename: PluginVCVirtualMachineService.ts

Function:GetAllVcVirtualDevicesByType

private GetAllVcVirtualDevicesByType<T>(objVcVirtualMachine: VcVirtualMachine): T[] {

    let arrVcVirtualDevice: VcVirtualDevice[] = this.GetAllVcVirtualDevices(objVcVirtualMachine);

    //@ts-ignore
    let arrVcVirtualDeviceType: T[] = arrVcVirtualDevice.filter((objVcVirtualDevice: VcVirtualDevice): objVcVirtualDevice is T => {
        //@ts-ignore
        return objVcVirtualDevice instanceof T;
    });

    return arrVcVirtualDeviceType;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like