diff --git a/wwwroot/remote.ps1 b/wwwroot/remote.ps1 index bc8084d..173a4b1 100644 --- a/wwwroot/remote.ps1 +++ b/wwwroot/remote.ps1 @@ -117,7 +117,9 @@ try { $stderr = "" try { - $output = & powershell.exe -NoProfile -NonInteractive -Command $command 2>&1 + # EncodedCommand umgeht alle Quoting-Probleme (Anführungszeichen, Sonderzeichen) + $encodedCmd = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($command)) + $output = & powershell.exe -NoProfile -NonInteractive -EncodedCommand $encodedCmd 2>&1 $stdoutLines = @($output | Where-Object { $_ -isnot [System.Management.Automation.ErrorRecord] }) $stderrLines = @($output | Where-Object { $_ -is [System.Management.Automation.ErrorRecord] }) | ForEach-Object { $_.ToString() }