Building the smallest PowerShell runner

Update (January 2018): Post revised for general availability of PowerShell 6. The main difference is the name of the PowerShell executable on Linux. In the older beta I used in the original post, it was still “powershell”. Now it is “pwsh”.

The Problem

At the day job, one of my team’s current projects is a bespoke “serverless” script execution service for internal use, not unlike AWS Lambda or similar offerings. I’m not the main guy on this, but I’ve been involved in some interesting discussions about how we should control the execution environments. Ideally, they would be sandboxed and completely disposable, possibly only alive for the lifetime of the script they are executing. The obvious solution to this is to use containers.

The dominant scripting language amongst our user base is PowerShell, so we need to try