Policy: Run a module if process X is not running?


  • I'm new to TOEM but I like it a lot so far, but I struggle with some details.

    I have created a module to start a certain application update. I wanted to create a policy that uses a Condition to check if the application in question is currently running and run the update module if it's not. I can use powershell with

    Get-Process X*
    

    in order to find the process (which will output nothing if the process is not found and otherwise will output the process information). But how can I tell TOEM to run the policy if this condition script module gives no output?

    TIA
    SoWhy


  • Okay, I figured it out by reading the manual for another, unrelated module. For those who struggle with the same problem:

    Create a script module with the content

    if (! (Get-Process X)) { Exit -1 }
    

    where "X" is the name of the process. You can use * as a wildcard, e.g. X* will match any process whose name starts with "X". Set the "Success Codes" value to "-1" and toggle "Use As Condition". Save the module with some name you can remember, e.g. "Check if X is running"

    Now, when creating a policy, you can use this module as a condition in the "Conditions" tab and it will only run if the process is not running.