There is no output to this script when I run it. I think that its something obvious but although it creates the test.txt, no data is put in it on files that it deletes!
Thanks in advance
$limit = (Get-Date).AddDays(-7)
Get-ChildItem 'C:\temp' -Recurse |
Where-Object {
-not $_.PSIsContainer -and $_.CreationTime -lt $limit
} | Remove-Item | Out-File -FilePath c:\text.txt