Comparison of Managed Code Responses and Script Responses
The storage, deployment, and running of managed code response assemblies is very similar to the use of standalone executables or console commands in rule responses. The managed code response assemblies must be deployed manually, and they must be stored on the file system of the MOM server and monitored computers. They are not stored in the MOM operations database.
In flexibility and power, however, the managed code responses more closely resemble script responses. In some cases, there might be reasons to port an existing script response to a managed code response assembly. The following table describes the most important differences between the COM-based script responses available in previous versions of MOM, and the new managed code responses:
| Feature | Script Responses | Managed Code Responses |
|---|---|---|
| Programmatic access to the response context. | Yes, using the ScriptContext object. | Yes, using the Context class. |
| Ability to create a new alert | Yes | Yes |
| Ability to create a new state monitoring alert. | Yes | Yes |
| Ability to create a new MOM event. | Yes | No |
| Ability to create a new MOM performance data item. | Yes | No (not supported) |
| Ability to create and submit computer discovery data. | Yes | No |
| Supported programming languages. | All COM-compatible scripting languages, including 3rd party extensions. | All .NET Framework languages, including 3rd party extensions. |
| The programming language of the response must be explicitly specified. | Yes | No, all assemblies store instructions using the Microsoft intermediate language (MSIL). |
| Ability to store response as native code. | No | Yes, the assembly can be compiled with the Native Image Generator (NGen.exe) tool and stored in the native image cache to improve performance. |
| Stored in MOM database. | Yes | No |
| Ability to directly invoke a component from a MOM rule. | No | Yes. For example, a managed code response can call methods in an assembly that belongs to the product you are monitoring. In this scenario, you will avoid distributing and deploying custom assemblies to support the rule's response. |
| Distribution mechanism | Management Packs | A custom setup project might be required, unless the assembly already exists on the computer. |
| Deployment mechanism | MOM agents | Manual deployment, unless the assembly already exists on the computer. An XCOPY style deployment can be used for assemblies with simple requirements. |
| Update mechanism | MOM agent updates | Manual re-deployment |
| Source code can be viewed in the MOM UI. | Yes | No |
| Source code can be edited in the MOM UI. | Yes | No |
| Ability to call COM components. | Yes, but only if the component supports automation (scripting) clients | Yes, using COM interop. |
| Ability to call .NET assemblies. | Yes, but only if the assembly is COM compliant and the required interop marshalling code is available and configured. | Yes |