Public/Renderer/Set-ASRResolution.ps1

function Set-ASRResolution
{
    [CmdletBinding(DefaultParameterSetName = 'ByName')]

    Param(
        [String]$Shell,
        [Parameter(Mandatory, Position=0, ParameterSetName='ByNumbers')][int]$x,
        [Parameter(Mandatory, Position=1, ParameterSetName='ByNumbers')][int]$y,
        
        [ValidateSet('4k', '2.5k', 'FullHD', 'HDReady', '1024x768', '800x600')]
        [Parameter(Mandatory, Position=0, ParameterSetName='ByName')][string]$resolution
        )

        # first, get Shell we want to talk to
        $shellLocal = Get-ASDefaultShell
        if($PSBoundParameters['Shell']) {
            $shellLocal  = $Shell
        }
        if([System.String]::IsNullOrEmpty($shellLocal)) {
            Write-Host 'Target shell is not set. Please specify target shell with -Shell parameter or by Set-ASDefaultShellTarget snippet.'
            return
        }

        $_x = 0;
        $_y = 0;

        if($x)
        {
            $_x = $x;
            $_y = $y;
        }
        if($resolution)
        {
            if([System.String]::IsNullOrEmpty($resolution)) {
                Write-Host "You must provide both x and y for resolution. You can do so by specifying both -x and -y parameters, or pass size in 000x000 format.";
                return;
            }
            if($resolution.ToLower() -eq "4k") {
                $_x = 3840;
                $_y = 2160;
            }elseif($resolution.ToLower() -eq "2.5k") {
                $_x = 2560;
                $_y = 1440;
            }elseif($resolution.ToLower() -eq "fullhd") {
                $_x = 1920;
                $_y = 1080;
            }elseif($resolution.ToLower() -eq "hdready") {
                $_x = 1280;
                $_y = 720;
            }elseif($resolution.Contains("x")) {
                $split = $resolution.Split('x');
                $_x = [System.Int32]::Parse($split[0]);
                $_y = [System.Int32]::Parse($split[1]);
            }  
        }

        Write-Host "Setting resolution to $($_x)x$($_y)"

        $uri = "http://$($shellLocal):4444/api/renderer/setresolution?width=$($_x)&height=$($_y)" 
        $result = Invoke-RestMethod -Uri $uri -Method POST
        Write-Host $result
}