I've noticed that another consultant has a FIM Event Broker operation list that runs under more or less the following arrangement
- Perform import of an MA
- Run a powershell script
- On Failure stop operation list
- On Success continue
- Run additional operations
The sole purpose of the Powershell script in operation 2 appears to be to check the outcome of the first operation and to throw an exception under certain conditions (in this case the import had no changed in it). The later operations are task that are redundant if no import occurred, such as using scripts to log the outcome of operation 1.
Essentially the consultant has implemented an "if" condition to the operation list by having an operation that is dedicated to throwing errors and ceasing additional operations from running under a specific condition.
My issue with this approach is that in order for step two to function, an exception has been thrown. This exception will appear in the logs as an error, resulting in this case in 100's of errors appearing in the solution on a daily basis. My very strong belief is that in this circumstance, no actual error has occurred and as such, it should not be reported in the logs.
The actual intention though is interesting and one that may in fact be useful. As such, I'm wondering if we can 'fail' a Powershell operation without throwing an exception. In 3.0.X I've tested using a Powershell script that consists purely of
This is treated as a success by FIM Event Broker and the subsequent operation runs.
Could we add exit codes as a failure condition to the Powershell activities. There are possibly a number of scenarios where we may want to handle some sort of conditional statement without having exceptions thrown, populating the logs and perhaps suggestion there is an underlying issue when there isn't one.
Customer support service by UserEcho