Powershell: Pass parameter or variable from outside workflow to the workflow
I have a script that has a parameter. I use that parameter for multiple processes. After those processes are done I run a workflow so I can run other process in parallel. I then exit the workflow and run other processes. Is it possible to pass the parameter or variable from OUTSIDE the workflow into the workflow?
If I add the parameter $Group to the workflow the workflow fails. I've also tried $using:group and that doesn't work either.
If I remove $group from the computers.txt it works. I have this script running multiple times in a row so if I use a generic computers.txt it gets overwritten.
I don't expect that this is possible but I didn't know if anyone knew of any tricks.
param(
[Parameter()]
[string]$Group
)
Get-ADGroupMember $Group | Select-Object name -ExpandProperty name | sort-object | out-file C:\Scripts\$Group-computers.txt
Do stuff
Workflow Updates {
ForEach -parallel ($computer in (get-content C:\Scripts\$Group-computers.txt)) {
InlineScript { Do other stuff}
Updates
Do even more stuff
Windows for business | Windows Server | User experience | PowerShell
1 answer
Sort by: Most helpful
-
Deleted
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more