Within the dynamic code editor it is possible to perform custom compliance benchmarks against supported items.


Firstly, create a new agent plugin and add a new using statement to the top of the as follows
using CENTREL.XIA.Support;


Then override the Execute() method


  • Set the identifier to a unique GUID value
  • Set the display name, version number and description
  • Add the benchmark to the collection



/// <summary>

/// Provides the code executed by this plugin.

/// </summary>

public override void Execute()

{

ComplianceBenchmark benchmark = new ComplianceBenchmark();

       benchmark.Identifier = new Guid("244bbd41-e714-4b5f-a627-49c8aea00365");

       benchmark.Name = "Sample benchmark";

       benchmark.Version.Major = 1;

       benchmark.Description = "Sample benchmark description";

       benchmark.Complete();

       Item.ComplianceBenchmarks.Items.Add(benchmark);

}


Once this has been completed you can add results to the benchmark.


  • Each result must have a unique reference number in the form of a SerializableReferenceNumber - for example 1.0
  • The currently configured value must be provided
  • A boolean value can be passed, or a ComplianceBenchmarkResultType



Example 1: The AssetTag must be assigned to pass


WindowsMachine machine = Item as WindowsMachine;

benchmark.Results.Items.Add(new SerializableReferenceNumber(1,0),"Ensure the asset tag is assigned", machine.AssetTag.Value, !String.IsNullOrEmpty(machine.AssetTag.Value));



Example 2: The result does not apply so is marked as excluded on platform

(For more information on result types see the result types section)


benchmark.Results.Items.Add(new SerializableReferenceNumber(1,0),"The 'Account Logon Events' setting must be enabled", machine.OperatingSystem.Security.AuditPolicy.AccountLogonEvents.AuditTypeString, ComplianceBenchmarkResultType.ExcludedPlatform);