I have several Windows services and I thought it would be awesome if I could use Powershell to tap into my services and be able to check for internal objects and maybe change some configuration on the fly.
The idea would be to host a Powershell inside the service, easy job, create a runspace and a pipeline in which specific objects are exposed in the form of variables, no problem, and then be able to run Powershell code in that pipeline.
Easy done if the service had a GUI or if it was interactive in some way so it just asked for an input, so I could push that input into the pipeline and maybe display the info from the returned PSObject. But as it’s a windows service, there’s no interaction at all.
Now, since Powershell is built around thinking of remoting, I was wondering if there could be some way of creating a remote session to invoke commands but not on the Powershell environment of the computer, but in the pipeline of the Powershell hosted inside my windows service.
There are tons of examples of Powershell self hosting applications but none takes remoting into consideration.
I don’t know if I’m terribly misguided. If that would be the case, what would be in your opinion the best way to use Powershell to interact with a windows service? Something like the way we use powershell to interact and configure Exchange for example.
Thanks in advance