Examples

Simple Script Run


dispatch run ps .\Fix.ps1 --target PC001 --transport psrp

Use run ps when Dispatch should own execution, result capture, stdout/stderr, and run history.

Preview A Script Run


dispatch run ps .\Fix.ps1 --target PC001 --transport psrp --plan --output json

Multi-Target Run


dispatch run cmd whoami --target PC001,PC002 --transport winrm --output json --no-progress

Inventory


defaults:
  transport: psrp
  credential: prod-admin
groups:
  kiosks:
    hosts: [KIOSK01, KIOSK02]
hosts:
  SERVER01:

dispatch run ps .\Fix.ps1 --inventory .\hosts.yml --target kiosks

Config


dispatch:
  default_transport: psrp
  default_credential_provider: prompt
credentials:
  prod-admin:
    provider: prompt
    username: CONTOSO\prod.admin

Credential Override


dispatch run ps .\Fix.ps1 --target PC001 --credential prod-admin

--credential selects the endpoint credential for transport authentication. It is not a script input secret.

Script Secret Preview


dispatch run ps .\Install-App.ps1 --target PC001 --secret packageSas=prod-package-sas --plan --output json

The --secret name=reference surface maps a configured secret reference to a script parameter. In this example the script should declare param([string]$packageSas), and current plan/dry-run output may show only -packageSas [redacted] without resolving the reference. Roadmap 10 owns runtime provider resolution and safe transport parameter binding. Secret values are not ordinary command-line arguments and must not appear in logs or results.

Logs


dispatch logs list
dispatch logs show latest
dispatch logs export latest --dest .\exports

Push A File


dispatch push .\payloads\agent.msi --dest C:\ProgramData\Dispatch\Payloads\agent.msi --target PC001 --transport psrp --checksum

Use push when the remote destination path matters.

Push And Execute A Script


dispatch push .\Fix.ps1 --dest C:\Temp\Fix.ps1 --target PC001 --transport psrp --execute --cleanup

This copies Fix.ps1 to C:\Temp\Fix.ps1, runs that remote file, then removes it after successful execution. Use dispatch run ps .\Fix.ps1 instead when the goal is simply managed script execution.

Transport Examples


dispatch run ps .\Fix.ps1 --target PC001 --transport psrp
dispatch run cmd whoami --target PC001 --transport winrm
dispatch run ps .\Fix.ps1 --target PC001 --transport psexec