Communicate with a Powershell service executable

Hello Ironsman’s,

Is there a easy and secure way to communicate service, that’s created with Powershell Pro Tools? As a simple example:

I created a tool, that will run a code to check multiple repository’s if a package must be installed, updated or removed or skipped. It’s a small executable around 6 MB (I think), but the tool checks around 60 different packages.

This tool runs at startup and checks every 2 hours if any new package is available, but a small executable package from “6 MB x 60 packages” = “360 MB” every 2 hour and I want to try to set it up as a service.

So it doesn’t need to load the “6 MB x 60 packages” = “360 MB” every 2 hours again, and again and again. There is not a performance problem, but I think a service that’s receiving a command and outputs the result will save a lot resources and will make it faster.

And it needs to be a executable, the main deployment tools will ask the code to check a package id, on a repository and the tool will run and returns just simple a exit code (1 install, 2 update and 3 remove).

Also I can think for more scenario’s I can create and use a Powershell service to communicate with. So I hope someone have a quick and simple tip for me, before I spend hours and late night on something I think someone already knows.

Please let me know, when it’s finished I can share the code’s.

Kind regards,
ARKO

Hi Arko
I’m not sure where the communication bit comes into play, do you mean in addition to the service running every 2 hours, you would like to also have the ability to tell it to check for package updates on demand?
Cheers
Keir

You can use Named Pipes to communicate between processes or scripts. I use it to trigger an action from a running script as a Service. Let me know if you are interested in exploring this to send you a sample code.