onboarding-diagnostic.ps1: add a PowerShell-version guard. The probe is PS3+ by design (Get-CimInstance, [ordered], ConvertTo-Json); on stock PS2 (Win7 SP1 / 2008 R2 without WMF) it crashed with cryptic [ordered] errors and emitted empty DIAG-JSON (first hit: AMT-PC). Now on PS<3 it emits a legible, parseable result inside the DIAG-JSON markers (hand-built JSON) with a WMF 5.1 / KB3191566 remediation hint instead. Parses clean. True PS2-native probe stays an RMM Thought. memory: add feedback_windows_quote_stripping (+ index) consolidating the two recent embedded-double-quote incidents (PowerShell->curl.exe CommandLineToArgvW, RMM->cmd.exe shutdown /c) into one root cause + fix, so future ref= entries land. errorlog: the two self-logged entries from #32333 (preview-skip friction, AMT-PC/Scileppi conflation correction). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.4 KiB
2.4 KiB
name, description, metadata
| name | description | metadata | ||
|---|---|---|---|---|
| feedback_windows_quote_stripping | On Windows, embedded double-quotes in command args get stripped/mangled twice over — by PowerShell-invoked curl.exe (CommandLineToArgvW) and by the GuruRMM cmd shell layer. Build quoted args without literal embedded double-quotes. |
|
On Windows, embedded double-quotes inside a command argument get silently
stripped or mangled at two separate layers we hit repeatedly. The body of the
arg survives; the " characters vanish, so the receiving program sees broken
syntax (an undefined constant, a usage dump, a parse error) — never a clean error
that points at quoting.
Two confirmed failure layers:
curl.exeinvoked from PowerShell — Windows re-parses the process command line viaCommandLineToArgvW, which eats the inner"in--data-urlencode 'x="y"'. A pfSensediag_command.phpPHP body becameecho PHPRUNS-OK->echo PHPRUNS-> "Undefined constant" (cost ~4 wasted RMM round-trips). (Howard, 2026-06-16.)- GuruRMM
command_type:shell(cmd.exe) layer —shutdown /r /t 60 /c "comment"had its"comment"quotes mangled through the agent's cmd layer; shutdown rejected the args and dumped usage. Fix was to drop/centirely. (2026-06-16.)
Why: It's the same root cause both times — Windows command-line re-tokenization
(CommandLineToArgvW) strips a layer of double-quotes that a Unix shell would have
preserved. PowerShell -> native exe, and RMM -> cmd.exe, each add a re-parse.
How to apply:
- Don't put literal embedded double-quotes inside an arg you pass through
PowerShell->curl.exe or RMM->cmd. Prefer single-quotes for the outer payload and
construct any needed
"from[char]34(PowerShell) — keep the command on one line. - For JSON request bodies, use a single-quoted heredoc (
<<'JSON') with--data-binary @-(per the Syncro/RMM skill rules) — that bypasses command-line re-parsing entirely. This is the reliable path. - If an arg with quotes is unavoidable, drop the quoted part (as with
shutdown /c) or move the value into a file/variable the program reads itself. - Distinct-but-adjacent gotchas: non-ASCII chars in payload text also break on
Windows/Git-bash (see feedback_ascii_only_api_payloads);
/tmpresolves differently between Write and Git-bash (see feedback_tmp_path_windows); PowerShell variable names are case-insensitive (see the errorlog$gUid/$guidincident).