How I Created a Free and Open Source PowerShell Command/Module that Can Scan Domain Controllers and Generate Reports on Active Directory Events

Question:

How would you describe the features and benefits of a free and open source PowerShell command/module that you developed, which can generate various reports on Active Directory events by scanning domain controllers in parallel and overcoming the limitations of Get-WinEvent?

Some additional ways to rephrase the question are:

  • – What are the advantages and functionalities of your open source PowerShell command/module that can produce different reports on Active Directory events by parallelizing the scanning of domain controllers and bypassing the constraints of Get-WinEvent?
  • – How does your PowerShell command/module that you created as a free and open source project enable you to create various reports on Active Directory events by concurrently scanning domain controllers and circumventing the restrictions of Get-WinEvent?
  • Answer:

    How to Generate Reports on Active Directory Events with a Free and Open Source PowerShell Command/Module

    Active Directory (AD) is a critical component of many IT environments, as it stores and manages information about users, computers, groups, policies, and other objects in a network. However, keeping track of all the changes and activities that occur in AD can be challenging, especially when there are multiple domain controllers (DCs) involved. How can you monitor and audit the events that affect your AD infrastructure, such as user logons, group membership changes, computer deletions, or policy modifications?

    One possible solution is to use a PowerShell command/module that I developed, called PSWinReportingV2. This is a free and open source project that can generate various reports on AD events by scanning DCs in parallel and overcoming the limitations of Get-WinEvent. In this article, I will describe the features and benefits of this command/module and how you can use it to get insights into your AD environment.

    PSWinReportingV2 is a PowerShell command/module that can scan the event logs of DCs and produce different reports on AD events, such as:

    • Computer changes – Created / Changed
    • Computer changes – Detailed
    • Computer deleted
    • Group changes
    • Group changes
    • – Detailed

    • Group changes
    • – Created / Deleted

    • Group enumeration
    • Group membership changes
    • Group policy changes
    • Logs Cleared Other
    • Logs Cleared Security
    • User changes
    • User changes
    • detailed

    • User lockouts
    • User logon
    • User logon
    • Kerberos

    • User status changes
    • User unlocks
    • The command/module can also support any kind of events from event logs, such as ADConnect, Hyper-V, and other types of data, as long as you provide the appropriate configuration files.

      The command/module is based on the Find-Events cmdlet, which is the core function that performs the scanning and reporting. The syntax of the cmdlet is:

      “`powershell

      Find-Events -Report -DatesRange -Servers

      “`

      The parameters are:

    • `-Report`: The type of report you want to generate, based on the list above or your custom configuration files.
    • `-DatesRange`: The time range you want to scan, such as Last24Hours, LastWeek, LastMonth, etc.
    • `-Servers`: The names of the DCs you want to scan, separated by commas.
    • The output of the cmdlet is a PowerShell object that contains the relevant information for each event, such as the event ID, the event time, the event message, the event data, and the event source. You can pipe the output to other cmdlets, such as Format-Table, Export-Csv, or Out-GridView, to display or save the data in different formats.

      Alternatively, you can use the Dashimo module, which is another project that I developed, to create a HTML dashboard from the output of the Find-Events cmdlet. The dashboard can show the data in a more visual and interactive way, such as charts, tables, filters, and tabs. You can also customize the look and feel of the dashboard with your own CSS and JavaScript code.

      What are the advantages and functionalities of PSWinReportingV2?

      PSWinReportingV2 has several advantages and functionalities that make it a useful tool for AD event reporting, such as:

    • It is free and open source, which means you can use it without any cost or license restrictions, and you can also modify the code or contribute to the project if you want.
    • It can scan multiple DCs in parallel, which means it can speed up the process and reduce the load on each DC. It uses runspaces to achieve this, which are lightweight threads that can run PowerShell commands concurrently.
    • It can overcome the limitations of Get-WinEvent, which is the native PowerShell cmdlet for querying event logs. Get-WinEvent has some issues, such as not being able to filter by event data, not being able to handle large event logs, or not being able to access remote event logs without WinRM. PSWinReportingV2 can bypass these problems by using a different method to access the event logs, which is based on the .NET class System.Diagnostics.Eventing.Reader.EventLogReader.
    • It can prettify the output, which means it can format the event data and message in a more readable and understandable way. It can also translate the event data into human-friendly values, such as user names, group names, computer names, etc. It can also color-code the output based on the event type, such as green for success, red for failure, yellow for warning, etc.
    • It can support any kind of events from event logs, as long as you provide the appropriate configuration files. The configuration files are JSON files that define the parameters for each report type, such as the event IDs, the event sources, the event data fields, the event message template, etc. You can create your own configuration files for any events that you are interested in, such as ADConnect, Hyper-V, or other types of data.
    • How to use PSWinReportingV2?

      To use PSWinReportingV2, you need to install the module from the PowerShell Gallery, which is the official repository for PowerShell modules. You can do this by running the following command in a PowerShell session:

      “`powershell

      Install-Module -Name PSWinReportingV2

      “`

      You also need to install the Dashimo module, if you want to create HTML dashboards from the output of the Find-Events cmdlet. You can do this by running the following command:

      “`powershell

      Install-Module -Name Dashimo

      “`

      After installing the modules, you can use the Find-Events cmdlet to generate reports on AD events by specifying the report type, the date range, and the server names. For example, if you want to generate a report on group membership changes in the last three days, and scan two DCs named AD1 and AD2, you can run the following command:

      “`powershell

      Find-Events -Report ADGroupMembershipChanges -DatesRange Last3days -Servers AD1, AD2

      “`

      This will produce an output like this:

      |

      4728 |

      EventID | EventTime | EventMessage | EventData | EventSource
      ——- | ——————- | ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————–| ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————–| EventSource

      2023-02-

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Privacy Terms Contacts About Us