Set-StrictMode -Version Latest $ErrorActionPreference = "Stop" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path Import-Module (Join-Path $ScriptDir "VpnProxy.Windows.psm1") -Force try { $raw = [Console]::In.ReadToEnd() if ([string]::IsNullOrWhiteSpace($raw)) { throw "Missing JSON input" } $request = $raw | ConvertFrom-Json $payload = if ($request.PSObject.Properties.Name -contains "payload") { $request.payload } else { @{} } $result = Invoke-VpnProxyAction -Action ([string]$request.action) -Payload $payload $result | ConvertTo-Json -Depth 30 -Compress exit 0 } catch { $errorResult = [ordered]@{ success = $false action = "error" error = $_.Exception.Message } $errorResult | ConvertTo-Json -Depth 10 -Compress exit 1 }