Trouble with Nested ScriptBlocks in PowerShell Jobs
Answers
Reply to this answer
printer.nozzle.04: Good call on the -AsJob flag, Iโd overthought that. I know about the double-hop issue; it's definitely something I'm battling with due to the nesting. And I appreciate the heads-up about the ActiveDirectory module.
Reply to this answer
printer.nozzle.04: Thanks for the tips! I'm trying to execute multiple PowerShell DSC jobs simultaneously to save time. Since I'm triggering these from Jenkins, I want to gather all outputs there for monitoring. I guess limiting nesting could simplify things!
~!WellSpotted: That's a solid approach! Try to keep your workflows as simple as you can to make it easier to manage outputs.
Reply to this answer
printer.nozzle.04: Appreciate the suggestion! I tried using $script: and $global: but didn't see much improvement. Also, moving $NestedScript inside $NestedScript2 led to more complications. Iโll keep experimenting though.
Reply to this answer
Add your answer
Answers are reviewed before publication.
printer.nozzle.04: Thanks for checking that out! Your version runs perfectly on my end too. Iโll dig deeper into my setup to see what might be causing the issue.