Skip to content

Instantly share code, notes, and snippets.

@vcaraulean
Created June 10, 2016 15:04
Show Gist options
  • Save vcaraulean/6d63253e8eb933f41bbd44ea7297793d to your computer and use it in GitHub Desktop.
Save vcaraulean/6d63253e8eb933f41bbd44ea7297793d to your computer and use it in GitHub Desktop.
psake - passing in parameters
$scriptPath = $MyInvocation.MyCommand.Path
$scriptDir = Split-Path $scriptPath
Get-Module psake | Remove-Module
Import-Module ("C:\Dev\Tools\psake.4.6.0\tools\psake.psm1")
$envProperties = @{
"starterParam1"="start param value"
"starterParam2"=
"start param 2 value", `
"sadkjsahd", `
"item3"
}
invoke-psake $scriptDir\tasks.ps1 -properties $envProperties
properties {
$localTaskValue = " -- local -- "
$starterParam1 = $null
$starterParam2 = $null
}
task default -Depends Task1
task Task1 {
"..discovered parameters.."
Write-Host $psake.context.Peek().properties
"..individual params.."
Write-Host "starterParam1: $starterParam1"
Write-Host "starterParam2: $starterParam2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment