We want to run a Python script that will do an operation and return a value which we want to store in MIM in attribute called “myTestvalue”.
In your Python script there are several ways to return a value. The Return function works for Python to Python communication. We are going to run this function in the MIM WAL PowerShell activity so we need communication with PowerShell. Use the standard out function.
So say our desired return value is in returnvalue1, we will have this in the Python code, at the end of operation
In MIM workflow, select Powershell activity.
If you run the in PS V2, the Python script will return nothing. You must run in in PS V3 or higher so write this
$myoutput=PowerShell -version 3.0 C:\Temp\Mypythonscript.py
Specify there is a Return type – Single Value. In the Return lookup value I put the attribute I want to store it in [//Target/myTestVale]. You can also put it in WorkflowData if you want to do something extra