Function: vCenter Virtual Machine Snapshot Create

by Simon Sparks · 2 February 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

Function: SnapshotCreate

public SnapshotCreate(objVcVirtualMachine: VcVirtualMachine, strName: string, blnMemory: boolean = false, blnQuiesce: boolean = false): VcTask {

    let objDate: Date = new Date();

    let strTimestamp: string = System.formatDate(objDate, "YYYY-MM-dd HH:mm:ss");

    let strDescription: string = `Snapshot taken on ${strTimestamp} with Memory ${blnMemory ? "On" : "Off"}) and Quiesce ${blnQuiesce ? "On" : "Off"}`;

    let objVcTask: VcTask = objVcVirtualMachine.createSnapshot_Task(strName, strDescription, blnMemory, blnQuiesce);

    return objVcTask;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like