Automation

 View Only
  • 1.  PowerCLI taking very long to import

    Posted Dec 30, 2021 10:27 PM

    I just uninstalled PowerCLI 11 and installed 12 (couldn't do update-module because of signing issues), and now it takes 5 minutes to import-module. I tried the steps recommended in the following thread, but no luck: https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/quot-Import-Module-VMware-PowerCLI-quot-Takes-5-Minutes-Taking/m-p/1828493

    I'm also not thrilled to see that's the solution. Why is it taking so long? What else can I do to try to fix it?



  • 2.  RE: PowerCLI taking very long to import

    Posted Dec 30, 2021 10:41 PM

    Is the station where you do the Import-Module isolated from the Internet?
    Did you check if there are timeouts when the modules are trying to connect to verify the certificate?
    Did you do an IMport-Module -Name VMware.PowerCLI?
    SInce 12.* that includes quite a bit of modules to be loaded(compared to 11.*).
    Do you need all those modules?
    Try importing only the modules you need for your code.



  • 3.  RE: PowerCLI taking very long to import

    Posted Dec 30, 2021 11:29 PM

    The PC I'm using does have internet access. I did notice that there are a lot more modules in PowerCLI in 12. I use quite a bit of PowerCLI commands in some of my scripts, so I usually do import-module vmware.powercli as a catch all. I suppose I can identify the exact modules I need rather than using the manifest. However, taking 6+ minutes to load PowerCLI seems a bit ridiculous.



  • 4.  RE: PowerCLI taking very long to import

    Posted Dec 31, 2021 08:57 AM

    When you are using the most common cmdlets, you definitely do not need to load all PowerCLI modules.
    Investing a bit of time to find out which modules actually need to be loaded, saves you a lot of time later.

    Taking into account the number of modules, and the certificate checking for the signed modules, does require some time I'm afraid.

    If you find it "ridiculous" I suggest opening an SR.
    There are ways to limit the number of modules depending on the environment you're working in.
    Perhaps the PowerCLI Dev Team might investigate and officialise those methods.