Script for hub is erroring with "The event timed out"

Script for hub is erroring with "The event timed out"

avatar
(anonymous user)
Product: PowerShell Universal
Version: 5.4.2


I’m just starting to mess around with PU and I’m using an agent on a test machine to try and execute just a simple “Get-ComputerInfo” right now. I have the agent showing up under Event Hubs → Connections but when I try to run my script (which I copied from the Ironman YouTube video on agents) the job errors out with this:

The event timed out.
at <ScriptBlock>, /root/.PowerShellUniversal/Repository/Windows Tools/Run Test.ps1: line 2
at <ScriptBlock>, /root/.PowerShellUniversal/Repository/Windows Tools/Run Test.ps1: line 1
at <ScriptBlock>, <No file>: line 1


Here’s the code:

Get-PSUEventHubConnection | Where-Object { $_.EventHub -eq 'Windows Desktops' -and -not $_.Disconnected} | ForEach-Object{
    Invoke-PSUCommand -ConnectionId $_.ConnectionId -Hub 'Windows Desktops' -Command "Get-ComputerInfo"
}


Am I doing something wrong here? Thank you for any assistance.

All Comments (3)

avatar

I haven’t see any YouTube videos for it but, the official instructions/doc is here: Event Hubs | PowerShell Universal

You can see that the samples are largely different than what you have.

I created a script with your code, and only altered the name of the hub to use on one of my hubs/agents, and it ran fine. Did you create the helper script on the Agent side? As I mentioned, I haven’t seen any YouTube videos for this, so I’m not aware of what all it says to do. The doc I linked above is what I set mine up with, and your script works in my setup.

avatar
(anonymous user)

Thanks Jesse! I’ll dig more into then, maybe it’s something with the file names.

This is the video I was referring to: https://www.youtube.com/watch?v=BK7XvIMnVss

avatar

Sure. If you’re seeing a connected agent on the PSU server side, you obviously have the agent.json file configured right on the Agent side.

How are you calling your script? Is it from a scheduled job, or are you manually running it, or is it being triggered by an API (Endpoint), etc.?