mttp1990 mttp1990 - 1 year ago 96
Bash Question

send argument/command to already running Powershell script

Until we can implement our new HEAT SM system i am needing to create some workflows to ease our currently manual user administration processes.

I intend to use Powershell to execute the actual tasks but need to use VBS to send an argument to PS from an app.

My main question on this project is, Can an argument be sent to an already running Powershell process?


We have a PS menu app that we will launch in the AM and leave running all day.

Powershell HD Menu

I would love for there to be a way to allow PS to listen for commands/args and take action on them as they come in.

The reason I am wanting to do it this way is because one of the tasks needs to disable exchange features and the script will need to establish a connection a remote PSsession which, in our environment, can take between 10-45 seconds. If i were to invoke the command directly from HEAT (call-logging software) it would lock up while also preventing the tech from moving on to another case until the script terminates.

I have searched all over for similar functionality but i fear that this is not possible with PS.

Any suggestions?

Answer Source

I had already setup a script to follow this recommendation but i was curious to see if there was a more seamless approach

As suggested by one of the comments by @Tony Hinkle

I would have the PS script watch for a file, and then have the VBScript script create a file with the arguments. You would either need to start it on another thread (since the menu is waiting for user input), or just use a separate script that in turn starts another instance of the existing PS script with a param used to specify the needed action

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download