Reputation: 12228
If I have the following code, is it possible to pass the collection of parameters passed to New-AutomationVM to the inner Deploy workflow without individually specifying them.
New-AutomationVM is likely to have ~20 parameters, and that is going to be a considerable piece of code to then integrate into a second internal workflow. (that seems vulnerable to errors)
Is there a better way? (I'm sure at some point I've read about all parameters being included in a psobject style variable, but I can't find a reference to it any more)
workflow New-AutomationVM
{
Param($var1,$var2)
workflow Pre-DeploymentChecks
{ Write-Output $true }
workflow Deploy
{
Param($var1,$var2)
$checkResult = Pre-DeploymentChecks
}
Deploy -var1 $var1 -var2 $var2
}
New-AutomationVM -var1 "var1" -var2 "var2"
Upvotes: 1
Views: 851
Reputation: 54941
Not as far as I know. The usual solution would be Deploy @PSBoundParameters
, but neither $PSBoundParameters
or splatting are availble in a workflow.
Splatting is not permitted in workflow activities or in calls to workflows.
Source: Technet
All Windows PowerShell automatic variables are valid in workflows, except for the automatic variables in the following list. For a complete list of automatic variables, see about_Automatic_Variables.
•$Args
•$Error
•$MyInvocation
•$PID
•$PSBoundParameters
•$PsCmdlet
•$PSCommandPath
•$PSScriptRoot
•$StackTrace
Source: Technet
Upvotes: 1