Automation

 View Only
  • 1.  Multiple VMs Inventory using multitasking process ?

    Posted Dec 16, 2016 05:54 AM

    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



  • 2.  RE: Multiple VMs Inventory using multitasking process ?
    Best Answer

    Posted Dec 16, 2016 06:01 AM

    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


  • 3.  RE: Multiple VMs Inventory using multitasking process ?

    Posted Dec 16, 2016 07:59 AM

    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 ?



  • 4.  RE: Multiple VMs Inventory using multitasking process ?

    Posted Dec 16, 2016 10:28 AM

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



  • 5.  RE: Multiple VMs Inventory using multitasking process ?

    Posted Dec 19, 2016 09:35 AM

    I have sent an email from your site.



  • 6.  RE: Multiple VMs Inventory using multitasking process ?

    Posted Mar 19, 2017 06:22 PM

    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..



  • 7.  RE: Multiple VMs Inventory using multitasking process ?

    Posted Mar 19, 2017 07:01 PM

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