I am trying to create a Powershell workflow with a number of functions inside it.
My code, and the error...
workflow New-AutomationVM
{
function Pre-DeploymentChecks
{ Write-Output $true }
function Deploy
{ $checkResult = Pre-DeploymentChecks }
Deploy
}
New-AutomationVM
The term 'Pre-DeploymentChecks' is not recognized as the name of a cmdlet, function, script file, or operable program.
My intention was to create a deploy function that encapsulated all of the other functions. But it seems not possible to call a function from within a function within a workflow. i.e. I can call Pre-DeploymentChecks from the workflow, but not the function.
Obviously I could just put that logic outside of the functions, but this approach seemed a little tidier.
Am I doing something stupid! or is this just not possible within Powershell workflows?