quick question regarding the below piece of PS. When the script reaches the ‘-lt’ will it only take the time into consideration or the date too? For example, if the last write was at 13:00 on the 1st of jan and the next at 12:59 on the 2nd, woud the ‘-lt’ check think there was one minute of difference or include the date in it’s calculation?
$TestLastWrite = Get-Item -LiteralPath 'C:\Users\user1\Videos'
$CurrentDateTime = Get-Date
if ($TestLastWrite.LastWriteTime -lt $CurrentDateTime.AddMinutes(-60) ) {
do foo
}
But in this case it is not a matter of opinion. It is a fact that an object property of the type [DateTime] contains a certain moment in time. And that consist of a date and a time.
Great. That is often misunderstood and I just wanted to point that out.