Function: vCenter Virtual Machine Reserve Memory

by Simon Sparks · 5 January 2026

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

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

Filename: vCenterServerService.ts

public VcVirtualMachineReserveMemory(objVcVirtualMachine: VcVirtualMachine, intVcSharesInfoMemory: number, intVcResourceAllocationInfoMemoryReservation: number): boolean {

    let objVcSharesInfoMemory: VcSharesInfo = new VcSharesInfo();
    objVcSharesInfoMemory.shares = intVcSharesInfoMemory;
    objVcSharesInfoMemory.level = VcSharesLevel.high;

    let objVcResourceAllocationInfoMemory: VcResourceAllocationInfo = new VcResourceAllocationInfo();
    objVcResourceAllocationInfoMemory.reservation = intVcResourceAllocationInfoMemoryReservation;
    objVcResourceAllocationInfoMemory.shares = objVcSharesInfoMemory;

    let objVcVirtualMachineConfigSpec: VcVirtualMachineConfigSpec = new VcVirtualMachineConfigSpec();
    objVcVirtualMachineConfigSpec.memoryAllocation = objVcResourceAllocationInfoMemory;

    let blnReturn: boolean = this.VcVirtualMachineReconfigure(objVcVirtualMachine, objVcVirtualMachineConfigSpec);

    return blnReturn;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like