File System - Clean Directory step template errors out

For some reason, the File System - Clean Directory step template is erroring out on one of our tentacles:

WARNING: Some imported command names include unapproved verbs which might make
Info 14:38:40
them less discoverable. Use the Verbose parameter for more detail or type
Info 14:38:40
Get-Verb to see the list of approved verbs.
Info 14:38:40
Cleaning files from installation directory
Info 14:38:40
Include: LCF*..config;web..config
Info 14:38:40
Info 14:38:40
Paths To Clean: C:\Octopus\Applications\Internal\RasterImage3.Host\
Info 14:38:40
Scanning directory C:\Octopus\Applications\Internal\RasterImage3.Host\
Error 14:38:40
ForEach-Object : A parameter cannot be found that matches parameter name ‘File’

In an effort to track this down, I would like to run this script locally in the ISE from that box.

I see this in the code:

Running outside octopus


How do you manually invoke this script from outside octopus in the ISE?

Figured out how to save and execute the script. Looks like the following line causes error:

return Get-ChildItem -Path $path -Filter $filter -Recurse:$recursive -File

Ok, it appears that this script requires Powershell 3.0 or greater to run. Apparently, Powershell 2.0 it blows up.


I am sorry that you had this issue, and I am glad you found the reason. Thanks for pointing it out to us.
I’ve created a GitHub issue that you can track at the below link as it should work in 2.0.