• Put the date to a variable first it is the Get-Date that seems to be the problem in my example above.

    $source_dir = "B:\Database_Backups"

    $target_dir = "\\machine-b\Database_Backups"

    $d = Get-Date

    Get-ChildItem $source_dir\*.* -include *.bak, *.trn | where {$_.CreationTime -gt ($d.AddDays(-1))} | Copy-Item -Destination $target_dir