AmolPatil
Enthusiast
Enthusiast

Multiple VMs Inventory using multitasking process ?

Hello,

I was trying for long to make a script to fetch multiple VMs information from VC(s).

I got success to build a script with desired format and properties BUT this will go one my one ForEach ($vm in$Vms)

Now I am looking for code which will run as a job OR parallel process to fetch the 1000+ VMs information simultaneously to save the time and speedup the process.

Any Hint?

Regards,

Amol Patil

Regards, Amol Patil VCP 5
LucD
Leadership
Leadership

There are many ways to speed up a script.

  • use the Get-VIew cmdlet instead of the regular PowerCLI cmdlets.
  • use parallelism
    • with Start-Job you can run a script multiple times in the background (fastest method for now afaik)
    • use a PS Workflow
    • use Runspaces, but note that due to the way PowerCLI currently works, you can't use multiple threads in the same Runspace


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

View solution in original post

AmolPatil
Enthusiast
Enthusiast

Hey Luc,

Yes tried that way too and also tried your other post with job but no luck so far.

I will post my code then check if that is possible in that code.(That also i picked from diffrent sources and customized.)

Share me where to share that ? Emai ?

Regards, Amol Patil VCP 5
Reply
0 Kudos
LucD
Leadership
Leadership

You can reach me via the Contact page on my blog.


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

Reply
0 Kudos
AmolPatil
Enthusiast
Enthusiast

I have sent an email from your site.

Regards, Amol Patil VCP 5
Reply
0 Kudos
AmolPatil
Enthusiast
Enthusiast

Hey Luc,

Thanks a lot once again..

Finally after yours hints.. I was keep trying to do my VM Inventory using parallel... So finally it is working using Start-Job ☺️

Once again thanks a lot for assisting me or us always..

Regards, Amol Patil VCP 5
Reply
0 Kudos
LucD
Leadership
Leadership

Thanks.
Yes, Start-Job is the simplest and probably most optimal way to run PowerCLI scripts in parallel.


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

Reply
0 Kudos