Public/Renderer/Set-ASRResolution.ps1
function Set-ASRResolution { Param( [Parameter(Mandatory=$false)][String]$Shell, [Parameter(Mandatory=$true, Position=1)][string]$x, [Parameter(Mandatory=$false, Position=2)][string]$y ) # 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-ASDefaultShell snippet.' return } if([System.String]::IsNullOrEmpty($x)) { 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; } $_x = 0; $_y = 0; $hasY = $PSBoundParameters.ContainsKey("y"); if($x.Contains("x")) { $split = $x.Split('x'); $_x = [System.Single]::Parse($split[0]); $_y = [System.Single]::Parse($split[1]); } else { if( $hasY ) { $_x = [System.Single]::Parse($x); $_y = [System.Single]::Parse($y); } else{ 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; } } $uri = "http://$($shellLocal):4444/api/renderer/setresolution?width=$($_x)&height=$($_y)" $result = Invoke-RestMethod -Uri $uri -Method POST Write-Host $result } |