I need to run nested Jobs i.e. one job for each subscription (Start-Job)

%3CLINGO-SUB%20id%3D%22lingo-sub-1577781%22%20slang%3D%22en-US%22%3EI%20need%20to%20run%20nested%20Jobs%20i.e.%20one%20job%20for%20each%20subscription%20(Start-Job)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1577781%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20have%20a%20scenario%20where%20I%20am%20executing%20run%20command%20on%20each%20VM%2FVMSS%20of%20a%20subscription%20and%20to%20acheive%20this%20i%20am%20using%20%22Invoke-AzVMRunCommand%22%20with%20-AsJob%20parameter%20and%20there%20after%20tracking%20the%20object%20returned%20until%20completion.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%20i%20want%20to%20execute%20same%20operation%20for%20all%20100%20subscriptions%20in%20my%20environment%20but%20i%20am%20not%20able%20to%20perform%20this%20using%20%3CSTRONG%3EStart-Job%20-ScriptBlock%26nbsp%3B%3C%2FSTRONG%3E%2C%20any%20idea%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1577781%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
New Contributor

Hi,

I have a scenario where I am executing run command on each VM/VMSS of a subscription and to acheive this i am using "Invoke-AzVMRunCommand" with -AsJob parameter and there after tracking the object returned until completion.

 

Now i want to execute same operation for all 100 subscriptions in my environment but i am not able to perform this using Start-Job -ScriptBlock , any idea?

0 Replies