December 18, 2021
2:17 PM
Example log file
11/23/2014 19:22:04, Created, [path] Text [file]
11/23/2014 19:22:09, Changed, [path] Text [file]
11/23/2014 19:22:09, Changed, [path] Text [file]
11/23/2014 19:22:14, Deleted, [path] Text [file]

[file]
### SET FOLDER TO WATCH + FILES TO WATCH + SUBFOLDERS YES/NO
    $watcher = New-Object System.IO.FileSystemWatcher
    $watcher.Path = "[path]"
    $watcher.Filter = "*.*"
    $watcher.IncludeSubdirectories = $true
    $watcher.EnableRaisingEvents = $true  

### DEFINE ACTIONS AFTER AN EVENT IS DETECTED
    $action = { $path = $Event.SourceEventArgs.FullPath
                $changeType = $Event.SourceEventArgs.ChangeType
                $logline = "$(Get-Date), $changeType, $path"
                Add-content "[path]" -value $logline
              }    
### DECIDE WHICH EVENTS SHOULD BE WATCHED 
    Register-ObjectEvent $watcher "Created" -Action $action
    Register-ObjectEvent $watcher "Changed" -Action $action
    Register-ObjectEvent $watcher "Deleted" -Action $action
    Register-ObjectEvent $watcher "Renamed" -Action $action
    while ($true) {sleep 5}

How to use
Create a new text file
Copy & paste the above code
Change the following settings to your own needs:
folder to monitor: $watcher.Path = "[path]"
file filter to include only certain file types: $watcher.Filter = "*.*"
include subdirectories yes/no: $watcher.IncludeSubdirectories = $true
Save and rename it to [file]
Start monitoring by Right click » Execute with PowerShell
To stop monitoring, it's enough to close your PowerShell window
From <[link]> 