I’m not sure if this is because of network lag, or the fact that my lab is on a different AD domain (and different NTP clock) than my local computer. All I know is:
(Get-Item local\path\to\OriginalFile.txt).LastWriteTime –eq (Get-Item remote\path\to\CopyOfFile.txt).LastWriteTime
Does not work reliably. My solution is to arbitrarily rule that if the timestamps are within 5 seconds, they’re good enough. (Given that these files are manually updated, and I want to know if the files were recently updated or not, 5 seconds is fine.)
This is more of an exercise in using [Math]::Abs() than anything else.