ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
34 stars 2 forks source link

Event Hub Improvements #3487

Open adamdriscoll opened 1 month ago

adamdriscoll commented 1 month ago

Summary of the new feature / enhancement

We should improve event hubs. They are ok but we really could take advantage of them much more.

Run Scripts on Event Hub Clients

It would be cool to run scripts directly on connected event hub clients. We need to take licensing into consideration here and it's a bit more involved than just running the PS1 if we want all the interactivity of a script run directly in PSU. That said, we could keep it simple and just run the PS1 and get the output and not worry too much about the rest of the job implementation.

Event Hub Client Communication To Server

It would be cool if the event hub client could make calls back to the server for reasons. This could allow events to be sent from the client to server when certain things happen. It's possible to do this with our current API implementation but having a running service could allow for the event hub to register events and then send the data up the web socket without having to worry about additional authentication.

Named Functions on Server and Client

SignalR supports named methods for both client and server. This means that event hubs could register functions in both directions. For example, if you wanted to invoke the Xyz function on a client, you would do something like:

Send-PSUEvent -Hub MyHub -Function Xyz -ArgumentList @("Hello")

This would allow for providing far more functionality without having to create event hubs for each function. It would also be cool to register an event hub like this with a module rather than a PS1 script.

Proposed technical implementation details (optional)

No response

RockoTheeHut commented 1 month ago

My department has been looking at how to push work to remote servers from a more centralized approach and we considered using this feature. Specially we are looking at how to run a remote service that reports back data. Having it built in to PSU would be huge for us! As of now we are looking at a bunch of windows tasks to make API calls. It works, but more work.

One issue we aren’t sure there is a workaround for is the eventhubclient.json being in the clear on remote computers. This is a security issue for us. Having options to store connection data securely would be good for more locked down corporate environments. Something like local PS vaults.