Function: Get Parameter Sets Definition of a PowerShell Cmdlet

by Simon Sparks · 23 September 2026

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

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

Filename: OrchestratorService.ts

Description: Orchestrator Function to Get Parameter Sets Definition of a PowerShell Cmdlet

Function: getParameterSetsDefinitions

public getParameterSetsDefinitions(objPowerShellCmdlet: PowerShellCmdlet, strParameterSetName: string): string {

    // @ts-ignore
    let objInfo: any = objPowerShellCmdlet.getInfo();    //  Found in code but not in documentation.

    let arrParameterSet: any[] = objInfo.getParameters();

    let objParameterSet: any = arrParameterSet.find((objParameterSet: any): boolean => {
        return strParameterSetName === objParameterSet.getName();
    });

    return objParameterSet.getDefinition();
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like