How to use BatAction

I have been testing BatAction in our dev environment and have ran into a couple problems.

Our system is 2020R3, with the management server and event server on the same device.

When I add the BatAction plugin to the appropriate folder on the server and restart the event server service, the plugin shows up as a possible action on rules, but only for ones triggered by an event. It does not show up for either of the time-based options. Since my goal is to trigger the action on an event, I am not overly concerned about the time-based triggers.

However, when I try to use the plugin to run any .BAT file, including the sample file that comes with the plugin, nothing happens when I trigger the event. When I checked the Windows event log, I found the following error:

Failed to execute action. ActionId = e12278c6-b0c0-4f51-bf1f-544dd7ee2f87 Exception details:

System.MissingMethodException: Method not found: ‘Boolean VideoOS.Platform.FQID.op_Inequality(VideoOS.Platform.FQID, VideoOS.Platform.FQID)’.

at BatAction.BatActionActionManager.ExecuteAction(Guid actionId, Collection`1 actionItems, BaseEvent sourceEvent)

at VideoOS.EventServer.MIP.XpcoRuleItemProviders.MipActionHandler.Execute(ActionExecutionParams action)

Clearly, the plugin is triggering, but I can’t figure out why it is crashing.

Any help with this would be greatly appreciated.

There was an issue comparing FQIDs which was fixed. However this introduced the issue you report for plugins built with new MIP SDK and then deployed on older XProtect versions. To workaround the issue please change the sample.

In general you would need to change FQIDa == FQIDb to FQIDa.Equals(FQIDb) (and FQIDa != FQIDb to !FQIDa.Equals(FQIDb)

In practice the sample the need change in BatActionActionManager.cs in lines 78 and 168:

if (sourceEvent != null && sourceEvent.EventHeader != null && sourceEvent.EventHeader.Source != null && !sourceEvent.EventHeader.Source.FQID.Equals(null))

Thank you! That worked perfectly for triggering on an event, which is my primary concern right now.

However, I still do not see the option to execute a batch file based on time. Should I expect that to be missing with the older version of Milestone or is that different issue?

This is a known limitation of the MIP rule actions implementation currently that you can only implement actions triggered on event.

As it often is the documentation is focusing on what you can do and is weak in not stating clearly what you cannot do; make actions on time profiles. Ref.: https://doc.developer.milestonesys.com/html/index.html?base=gettingstarted/intro_rulesystem.html&tree=tree_search.html?search=rule