We have a script configured that runs the below block, with some other various things around it specific to our needs. The ArgumentList
of ThreadJob
contains both a global variable and a secret variable and both are evaluated as they are sent to the agent.
Start-ThreadJob -ThrottleLimit 3 {
param($url, $tkn, $cid)
Send-PSUEvent -ComputerName $url -AppToken $tkn -Hub EH_MDM -ConnectionId $cid -Data @{
Contents = Get-Content "Path\To\Script\Relative\To\Repository.ps1" -Raw
Parameters = @{
MatchQuota = 4
AppToken = $tkn
SiteRoot = $url
}
}
} -ArgumentList $SiteURL, $Secret:SecretVariable, $EventHubConnection.ConnectionId
Then on the agent we have a script configured very similarly to this one in the documentation:
Hope this helps!