I have some simple PowerShell scripts that I have made into executables with Bamboo, by adding a path such as `C:\build-scripts\bamboo-build-scripts\clear-directory.ps1` as the path for the executable for a new capacity in Bamboo.

However, several scripts, even ones that execute correctly in the build process when they are made as a "script" process, will fail when they are run in this way, by giving the return code -1. Here is an example from the build log:

```
simple  18-Jun-2015 13:14:06    Failing task since return code of [C:\build-scripts\bamboo-build-scripts\update-checker.ps1 GeometryClassLibrary] was -1 while expected 0

```

This occurs with multiple PowerShell scripts, and causes the rest of the build procecss to fail.

Here is an example PowerShell script, which I execute by passing the argument to a directory:

```
Remove-Item $args[0] -Force -Recurse
[io.directory]::CreateDirectory($args[0])

```

Is there something I need to add to the PowerShell script to make it exit with the correct code? Or am I not defining the executable properly in Bamboo?