|
1 |
| -# WinEventLogCustomization |
| 1 | +# ![logo][] WinEventLogCustomization |
2 | 2 |
|
3 |
| -# Description |
4 | 3 |
|
5 |
| -Description for the WinEventLogCustomization project. |
| 4 | +| Plattform | Information | |
| 5 | +| --------- | ----------- | |
| 6 | +| PowerShell gallery | [](https://www.powershellgallery.com/packages/WinEventLogCustomization) [](https://www.powershellgallery.com/packages/WinEventLogCustomization) [](https://www.powershellgallery.com/packages/WinEventLogCustomization) | |
| 7 | +| GitHub | [](https://github.com/AndiBellstedt/WinEventLogCustomization/releases/latest)  <br>  <br>  <br>  | |
| 8 | +<br><br> |
| 9 | + |
| 10 | +## Description |
| 11 | + |
| 12 | +A PowerShell module helping you build custom eventlog channels and registering them into Windows Event Viewer. |
| 13 | +The build logs appear under "Application and Services", even like the "Windows PowerShell" or the "PowerShellCore/Operational" EventLog.<br> |
| 14 | +<br> |
| 15 | +All cmdlets are build with |
| 16 | +- powershell regular verbs |
| 17 | +- pipeline availabilities wherever it makes sense |
| 18 | +- comprehensive logging on verbose and debug channel by the logging system of PSFramework<br> |
| 19 | +<br> |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +- Windows PowerShell 5.1 |
| 24 | +- PowerShell 6 or 7 |
| 25 | +- Administrative Priviledges are required for registering or unregistering EventChannels<br> |
| 26 | +<br> |
| 27 | + |
| 28 | +## Installation |
| 29 | + |
| 30 | +Install the module from the PowerShell Gallery (systemwide): |
| 31 | +```PowerShell |
| 32 | +Install-Module WinEventLogCustomization |
| 33 | +``` |
| 34 | +<br> |
| 35 | + |
| 36 | +## Quick start |
| 37 | +### Creating a manifest for a EventChannel |
| 38 | +For a quick start you can just execute: |
| 39 | +```PowerShell |
| 40 | +New-WELCEventChannelManifest -ChannelFullName "AndiBellstedt/MyPersonalLog" |
| 41 | +``` |
| 42 | +another way is the following command style, if you are not familiar with the notation on ChannelFullNames: |
| 43 | +```PowerShell |
| 44 | +New-WELCEventChannelManifest -RootFolderName "AndiBellstedt" -FolderSecondLevel "PowerShell" -FolderThirdLevel "Tasks" -ChannelName "Operational" |
| 45 | +``` |
| 46 | +This will create a manifest- and a dll file (*AndiBellstedt.man & AndiBellstedt.dll*) within you current directory.<br> |
| 47 | +With the manifest file, the dll file can be registered to Windows EventLog system. <br> |
| 48 | +**Attention**, the manifest file contains the paths to the dll and should not be moved in the Windows Explorer. *There is a command in the module to move the manifest with it's dll file consistently.* <br> |
| 49 | +<br> |
| 50 | +### Register the EventChannel |
| 51 | +Registering a manifest and its dll file is also easy: |
| 52 | +```PowerShell |
| 53 | +Register-WELCEventChannelManifest -Path .\AndiBellstedt.man |
| 54 | +``` |
| 55 | +**Attention, executing this command will require admninistrative priviledges.** <br> |
| 56 | +Due to the fact, that changes on the Windows EventLog system are a administrative task. <br> |
| 57 | +<br> |
| 58 | +Following this, results in a new folder "AndiBellstedt" with two subfolders ("PowerShell" & "Tasks") and a EventLog "Operational" under "Application and Services Logs" withing the Event Viewer.<br> |
| 59 | + |
| 60 | +![EventChannel][] |
| 61 | +<br> |
| 62 | +<br> |
| 63 | +### Remove the EventChannel |
| 64 | +If the EventChannel is no longer needed, it can be removed by unregistering the manifest: |
| 65 | +```PowerShell |
| 66 | +UnRegister-WELCEventChannelManifest -Path .\AndiBellstedt.man |
| 67 | +``` |
| 68 | +<br> |
| 69 | + |
| 70 | +### Show registered EventChannels |
| 71 | +After registering a manifest, the defined EventChannel can be queried<br> |
| 72 | +To query a EventChannel you can use: |
| 73 | +```PowerShell |
| 74 | +Get-WELCEventChannel -ChannelFullName "AndiBellstedt-PowerShell-Tasks/Operational" |
| 75 | +``` |
| 76 | +This will output something like this, showing you the details and the config of the EventChannel: |
| 77 | +``` |
| 78 | +PS C:\> Get-WELCEventChannel -ChannelFullName "AndiBellstedt-PowerShell-Tasks/Operational" | Format-List |
| 79 | +
|
| 80 | +ComputerName : MyComputer |
| 81 | +Name : AndiBellstedt-PowerShell-Tasks/Operational |
| 82 | +Enabled : False |
| 83 | +LogMode : Circular |
| 84 | +LogType : Administrative |
| 85 | +LogFullName : C:\WINDOWS\System32\Winevt\Logs\AndiBellstedt-PowerShell-Tasks%4Operational.evtx |
| 86 | +MaxEventLogSize : 1052672 |
| 87 | +FileSize : |
| 88 | +RecordCount : |
| 89 | +IsFull : |
| 90 | +LastWriteTime : |
| 91 | +LastAccessTime : |
| 92 | +ProviderName : AndiBellstedt-PowerShell-Tasks |
| 93 | +ProviderId : 43b94bbe-2d97-4f04-96b4-c254483b53f4 |
| 94 | +MessageFilePath : C:\EventLogs\AndiBellstedt.dll |
| 95 | +ResourceFilePath : C:\EventLogs\AndiBellstedt.dll |
| 96 | +ParameterFilePath : C:\EventLogs\AndiBellstedt.dll |
| 97 | +Owner : Administrators |
| 98 | +Access : {NT AUTORITY\BATCH: AccessAllowed (ListDirectory, WriteData), NT AUTORITY\INTERACTIVE: AccessAllowed (ListDirectory, WriteData), NT AUTORITY\SERVICE: AccessAllowed (ListDirectory, WriteData), NT AUTORITY\SYSTEM: AccessAllowed (ChangePermissions, CreateDirectories, Delete, GenericExecute, ListDirectory, ReadPermissions, TakeOwnership, WriteData, WriteKey)…} |
| 99 | +``` |
| 100 | +### Configuration on EventChannels |
| 101 | +There are multiple ways to configure a EventChannel.<br> |
| 102 | +The first, and explicit one is: <br> |
| 103 | +```PowerShell |
| 104 | +Set-WELCEventChannel -ChannelFullName "AndiBellstedt-PowerShell-Tasks/Operational" -Enabled $true -MaxEventLogSize 1GB -LogMode Circular -LogFilePath "C:\EventLogs\AB-PS-T-Ops.evtx" |
| 105 | +``` |
| 106 | + |
| 107 | +Another way is to pipe in the result of a `Get-WELCEventChannel` command: |
| 108 | +```PowerShell |
| 109 | +$channel = Get-WELCEventChannel "AndiBellstedt*" |
| 110 | +
|
| 111 | +$channel | Set-WELCEventChannel -Enabled $true -MaxEventLogSize 1GB -LogMode AutoBackup -LogFilePath "C:\EventLogs" |
| 112 | +``` |
| 113 | +Doing it this way, `$channel` can contain more than one EventChannel to configure.<br> |
| 114 | +<br> |
| 115 | + |
| 116 | +## Practical usage - Managing, creating and configuring multiple custom EventChannel |
| 117 | +<< more to come >> |
| 118 | +<br> |
| 119 | + |
| 120 | + |
| 121 | +[logo]: assets/WinEventLogCustomization_128x128.png |
| 122 | +[EventChannel]: assets/pictures/EventChannel.png |
0 commit comments