Product: PowerShell Universal Version: 5.3.0
Looking for any suggestions on this one. I have been setting up an Agent to run a simple EventHub command and am getting this error
$connection = Get-PSUEventHubConnection -Hub RadioBroadcastHub -TrustCertificate -Active Invoke-PSUCommand -Hub "RadioBroadcastHub" -Command "Get-Process" -ConnectionId $connection.ConnectionId -TrustCertificate
and get this result
Send-PSUEvent: Status(StatusCode="Unknown", Detail="Exception was thrown by handler. HubException: Client failed to parse argument(s).")
I can see the command reach the agent, and in its log it contains the following when I call the above
2025-02-17 19:12:27.057 +11:00 [ERR] Failed to bind arguments received in invocation 'null' of 'RadioBroadcastHubModule'. System.IO.InvalidDataException: Invocation provides 3 argument(s) but target expects 2. at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.BindTypes(Utf8JsonReader& reader, IReadOnlyList`1 paramTypes) at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.ParseMessage(ReadOnlySequence`1 input, IInvocationBinder binder)
The commands look identical to those in the training video (https://www.youtube.com/watch?v=BK7XvIMnVss), but for the life of me I cannot think of whats gone wrong
Recommended Answer
Figured it out. Its a bug in the agent. v5.3.0 of the agent does this, v5.2.2 of the agent succeeds fine
Have logged a bug EventHub Error when Invoking Command - Agent v5.3.0 Bug · Issue #4390 · ironmansoftware/powershell-universal · GitHub
Thanks for the assist parzog
Try with:-Data @{ command = "Get-Process" }
instead of -Command.
Also, keep in mind the transport is (to my knowledge) sent as JSON, which Get-Process converts VERY greedily into. I’ve had issues with running Get-Process. Try something simpler, like Get-Date, and see if you have the same issue.
Thanks @AnonymousUser . I think I did that previously, but retested for completeness.
If I use -Data I get the same message, but the counts are 1 less Invocation provides 3 argument(s) but target expects 2
Thats the same error I get if I test with Send-PSUEvent directly
Wondering if theres a way I can get the agent to be more verbose before I go and packet capture things at this point
Figured it out. Its a bug in the agent. v5.3.0 of the agent does this, v5.2.2 of the agent succeeds fine
Have logged a bug EventHub Error when Invoking Command - Agent v5.3.0 Bug · Issue #4390 · ironmansoftware/powershell-universal · GitHub
Thanks for the assist parzog
Sure thing, nice catch! I’m still on 5.2.1 until a couple additional things get ironed out but now I’m glad I did so and will be waiting until this is patched before updating further.
Be sure to mark your response as the solution for any future readers!