JiriNedved
Contributor
Contributor

Parallel uploads to different ESXi servers

Jump to solution

Hi guys,

I am trying to execute several simultaneous uploads to different ESXi servers.

I follow KB 2001041.

I am using Start-Job cmdlet with ScriptBlocks.

The output of the Get-Job cmdlet says, that those jobs are running sequentially. The next job starts after the previous has ended.

Please, could you give me an advice, how to run this kind of jobs simultaneously?

Thank you

1 Solution

Accepted Solutions
LucD
Leadership
Leadership

No problem :smileygrin:

After a quick look at your code, the reason why your background run in sequence, is due to the Wait-Job you have.

You can submit all Jobs and then move the Wait-Job outside of the foreach loop.

Your last lines could look like this

    Start-Job -ScriptBlock $ScriptBlock -ArgumentList $IPAddress, $ESXiCredential, $PSDriveName, $WorkingDirectory, $EntirePathToLogFile, $FileToBeUploaded, $EntirePathToFileToBeUploaded

}

Get-Job | Wait-Job


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

4 Replies
LucD
Leadership
Leadership

It would help if you could show us your code.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
JiriNedved
Contributor
Contributor

Hi LucD,

I attach my code:

- comments are in still in Czech, it is in the development stage

0 Kudos
LucD
Leadership
Leadership

No problem :smileygrin:

After a quick look at your code, the reason why your background run in sequence, is due to the Wait-Job you have.

You can submit all Jobs and then move the Wait-Job outside of the foreach loop.

Your last lines could look like this

    Start-Job -ScriptBlock $ScriptBlock -ArgumentList $IPAddress, $ESXiCredential, $PSDriveName, $WorkingDirectory, $EntirePathToLogFile, $FileToBeUploaded, $EntirePathToFileToBeUploaded

}

Get-Job | Wait-Job


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

JiriNedved
Contributor
Contributor

Thank you very much.

Your idea is correct.

Best regards

Jiří

0 Kudos