How to pass LastWriteTime to Invoke Powershell activity


I want to use the “Invoke Powershell” activity to obtain a list of files modified after a certain date.

This command works fine when I execute it directly in Powershell: Get-ChildItem -Recurse C:\Data*.* |Where-Object {$_.LastWriteTime -ge (Get-Date).AddDays(-10)}

I tried using using the Parameters argument in the Invoke Powershell activity. I added a Path parameter with the target directory (C:\Data*.* and Filter parameter, with the filter clause (Where-Object {$_.LastWriteTime -ge (Get-Date).AddDays(-10)} ) but this did not work, as it did not returned any results. It appears that the filter parameter only adds whatever you specify in the filter as part of the file path.

Is there a way t o pass the Where-Object filter to this activity?


PowerShell_FileCount.xaml (6.7 KB)