I'm looking for a script that gives a list of files that are modified in a date range (from 00.00 yesterday to 23.59 yesterday) but the list is empty.
Here the script:
$today = Get-Date
$yesterday = $today.AddDays(-1)
$today00 = $today | Get-Date -Hour 0 -Minute 0 -Second 0 -uformat "%d/%m/%Y %H:%M:%S"
$yesterday00 = $yesterday | Get-Date -Hour 0 -Minute 0 -Second 0 -uformat "%d/%m/%Y %H:%M:%S"
Invoke-Command -ComputerName xxx -Scriptblock {
Get-ChildItem -Path "xxx" -Recurse |
where-object {$_.mode -notmatch "d"} |
where-object {$_.lastwritetime -gt $yesterday00 -AND $_.lastwritetime -lt $today00 } |
Get-ChildItem -name |
out-file filelist.log
}
Someone can help me? Thanks :)