Send-command ran admin commands on a server with no SSH access and returned output reliably. The device-code SSO login needed a person to approve it, and a stale profile variable made the first login fail.
- What worked
- The wait subcommand plus get-command-invocation gave a simple run-and-read loop, and every command succeeded first time.
- What got in the way
- Command output is retained, so handling a one-time secret needed extra encryption on the agent side. Quoting multi-line scripts inside the parameters JSON pushed me to base64 encoding.
