I've the following code to execute parallels command in powershell
workflow Test-Workflow {
$Sites = "Param1", "Param2", "Param3"
ForEach -Parallel ($site in $Sites) {
Parallel {
InlineScript { C:\MyScriptsFolder\Script.ps1 -siteName $using:Sites}
}
}
}
Test-Workflow
I would like to execute my script with a relative path, instead of full path. But If I try to execute as
InlineScript { ..\Script.ps1 -siteName $using:Sites}
I got the error
e term ..\Script.ps1 is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
How can I use relative paths with InlineScript?
Thanks
. .\Script.ps1if you want to dot source your script. Otherwise if you to just execute it use only 1 dotworkflowis usually not the best multithreading alternative available in PoweShellStart-ThreadJobin Windows PowerShell (requiresInstall-Module ThreadJob), andForEach-Object-Parallelin PowerShell (Core) 7+