Fix: Remote Command Tool - EncodedCommand statt -Command für korrekte Anführungszeichen-Behandlung
This commit is contained in:
1 parent
c5db6d0dbd
commit
dd0bc263e0
1 file changed
+3
-1
+3
-1
@@ -117,7 +117,9 @@ try {
|
|||||||
$stderr = ""
|
$stderr = ""
|
||||||
|
|
||||||
try {
|
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] })
|
$stdoutLines = @($output | Where-Object { $_ -isnot [System.Management.Automation.ErrorRecord] })
|
||||||
$stderrLines = @($output | Where-Object { $_ -is [System.Management.Automation.ErrorRecord] }) |
|
$stderrLines = @($output | Where-Object { $_ -is [System.Management.Automation.ErrorRecord] }) |
|
||||||
ForEach-Object { $_.ToString() }
|
ForEach-Object { $_.ToString() }
|
||||||
|
|||||||
Reference in new issue
Block a user