Hey everyone,
I am trying to build a PowerShell script that watches a specific folder and logs any changes — such as files being added, deleted or renamed. I have been experimenting with Register-ObjectEvent
and System.IO.FileSystemWatcher
& while I have got it kind of working, it is not consistent. Sometimes it just stops picking up changes altogether or randomly misses events.
Not sure if it is something in the way I have structured the event handling or if I am missing a cleanup step somewhere. I want to keep this running in the background long-term, maybe even turn it into a basic service. i have check this Monitoring "copied" or "moved" files in powershell
Also, slightly off-topic but while messing around with this I have also been brushing up on some python interview questions for a job switch & man, switching between PowerShell and is messing with my brain a bit
Thank you..