The trick to getting CruiseControl.net build label into PowerShell script

is to use an environment variable.

The PowerShell Task is a subclassed Executable Task which loads a series of environment variables before the task is executed. You then just need to access those in your PowerShell script via the $Env variable.

In my case
$label = $Env:CCNetLabel

Scroll down to the Notes section of this page http://confluence.public.thoughtworks.org/display/CCNET/Executable%2BTask for a full list of the environment variables that are set.

Posted