Operating System - Microsoft
Showing results for 
Search instead for 
Did you mean: 

Running Powershell from within Bat file inside Process policy

Regular Advisor

Running Powershell from within Bat file inside Process policy


I'm hoping someone out there can think of a better way to accomplish our goal. Here's what we are trying to do:
- check to see if process is running
- if it isn't, run stored procedure to see if it is the time of day when it should be running
- if value returned to MT policy indicates it should be running, then execute command to start it up

This is all working when we hardcode server name on which to run stored procedure. Here's the complication:
- Process is running on store DC server
- Stored procedure is located on store unix server and we have over 100 stores. We need to parse out store number from DC server name and pass it in as unix server name. A batch file was created to do this, but it doesn't seem to be executing powershell correctly.
- The powershell command to run the stored procedure works correctly when executed from automatic command, but it doesn't work from within the batch file.

Any ideas? Not sure if I explained this clearly enough, so feel free to come back with questions.

Thank you,

Honored Contributor