Timeline for FileSystemWatcher works reliably, unless I write to a log file
Current License: CC BY-SA 4.0
Post Revisions
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 27, 2024 at 21:14 | comment | added | Santiago Squarzon | @mclayton in case you didnt get OP's response above | |
| Mar 26, 2024 at 8:23 | comment | added | Orange Pukeko | Yes, unfortunately it was this basic, something I have done right multiple other times in this script. If you add an answer, I'd happily accept. | |
| Mar 26, 2024 at 7:00 | comment | added | mclayton |
Guessing a bit - I think both your calls to Add-Content might be throwing exceptions - in the first, $log_file doesn’t have a value as it’s not inheriting from the top-level script scope so is $null and in the second call you’re only passing one parameter. Try adding some write-host "before add-content 1" / write-host "after add-content 1" trace calls and check if they actually execute during the first event that gets triggered...
|
|
| Mar 26, 2024 at 4:37 | history | asked | Orange Pukeko | CC BY-SA 4.0 |