Skip to content

(V2) Allow users to pass custom function in Functions event definition #87

@Indigo744

Description

@Indigo744

Hello,

First, let me say that your Powershell scripts are really good and super helpful 🐱

I am actually deploying PSWinReportingV2 in our AD in order to get AD changes report each morning. It is working great and I am able to get an email containing the summary with a dynamic HTML attached.

I noticed that the Group Policy changes was always empty. After some digging, I found out that I need to enable the audit for GPO changes (5136).

Now I can get the list of GPO changed in the report!

However, in the report, the changed GPOs are listed by their GUID only.
This is hard to get a quick understanding of which GPO was impacted, and also to find the real GPO.
I would love to be able to also get their name along with the GUID.

I noticed that the event definition has a Functions parameter that can apply a function to a specific field (here is an example).

My though was to provide a new function on the ObjectGuid field that hook up GPOZaurr to find the GPO with the GUID and return the real name.

Sadly, looking at the code behind it, I found out that the functions are hard-coded so I can't do this.

So to get to the proposal: I think it would be great if the user could provide a custom function that is automatically called.

The user could simply pass a script block or a function (using $FUNCTION:myCustomFn), and internally the script would do

$EventProperty.Value = Invoke-Command -ScriptBlock $EventsDefinition.Functions[$EventProperty.Name] -ArgumentList @($EventProperty.Value, $Event)

Notice the args list that pass the field value, and also the whole event (if needed).

Thank you and have a nice day!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions