Function: Add a PowerShell Host

by Simon Sparks · 1 May 2025

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 Copy of add a PowerShell Host

Function: PowerShellHostCreate

public PowerShellHostCreate(strName: string, strFQDN: string, strUsername: string, strPassword: string): PowerShellHost {
    //@ts-ignore
    let objPowerShellHostConfig: PowerShellHostConfig = new PowerShellHostConfig();
    objPowerShellHostConfig.name = strName;
    objPowerShellHostConfig.type = "WinRM";
    objPowerShellHostConfig.connectionURL = strFQDN;
    objPowerShellHostConfig.transportProtocol = "HTTPS"
    objPowerShellHostConfig.port = "5985";
    objPowerShellHostConfig.username = strUsername;
    objPowerShellHostConfig.password = strPassword;
    objPowerShellHostConfig.authentication = "Kerberos";
    //@ts-ignore
    objPowerShellHostConfig.authorizationMode = PowerShellAuthorizationMode.fromString("Shared Session");

    let objPowerShellHost: PowerShellHost = PowerShellHostManager.update(objPowerShellHostConfig);

    return objPowerShellHost;
}

Discover more from Cloud Build Tools

Subscribe to get the latest posts sent to your email.

You may also like