The following walkthrough demonstrates how to create a dynamic agent plugin to read a registry entry from the remote machine and store the information in a custom attribute.


  • Ensure that a custom attribute has been created and assigned to the appropriate item types. Make a note of the Attribute ID as this will be required later.



  • Within the administration tools go to the Agent Plugins section

  • Right click the list and select New.



  • Enter the name and description of the plugin.

  • As the plugin will be modifying the data created by the agent, ensure that the execution time is set to After Agent Scan.



  • Click Launch Code Editor.

  • Within the Dynamic Code Editor select the appropriate language either VB.NET or C#.NET.


  • Enter the following code in the Execute method.

    /// <summary>
    /// Provides the code executed by this plugin.
    /// </summary>
    public override void Execute()
    {
      WindowsMachineAgentSettings settings = (WindowsMachineAgentSettings)AgentSettings;
      WMI.Connect(settings.MachineName);
      String CustomValue = WMI.Registry.GetStringValue(@"SOFTWARE\CENTREL Solutions\XIA Configuration Service","");
      Item.CustomAttributes.Add("2161fb9d-b2a1-4750-a9a3-d472eb84e678", String.Empty, CustomValue);
    }

  • The settings are used to obtain the name of the Windows machine to connect to, this information could also be obtained from the Item property.

  • The WMI property provides local and remote Windows Management Instrumentation functions. It is not necessary to use the WMI helper functions. The NET registry and management classes may be used directly.

     WMI.Connect(settings.MachineName);

  • The Registry property of the WMI helper classes allows for direct access to the registry of the remote machine. In the example the "InstallDirectory" registry value of type REG_SZ is read.

    String CustomValue = WMI.Registry.GetStringValue(@"SOFTWARE\CENTREL Solutions\XIA Configuration Service","InstallDirectory");

  • As the plugin is running After Agent Scan, the Item property provides access to the data generated by the agent, which can be modified. The custom attribute is added to the collection. The unique ID of the custom attribute is the value that was noted at the start of this walkthrough.

    Item.CustomAttributes.Add("2161fb9d-b2a1-4750-a9a3-d472eb84e678", String.Empty, CustomValue);

  • Click Validate Configuration to ensure the code compiles correctly, and then click Save.

  • Close the Dynamic Code Editor and click OK.

  • Go to the Scan Profile that you are editing and go to the Default Agent Settings and then the Windows Machine Agent Settings.

  • On the Plugins tab right click the newly create plugin and select Enable.