PowerCLI

 View Only
  • 1.  PowerCli load time is insane

    Posted May 20, 2022 09:54 AM

    Hi

    What is up with the extreme load time of the recent version of PowerCli. This is getting out of hand It takes now more than 4 min to load PowerCli on my laptop! Compared to v11 it was only around 1min to load all the modules. I see this across servers (VMs) and different laptops and OS's ( Windows Server 2019/Client 10/11). I anyone else seeing this or having a fix for it?

    PS C:\Users\Michael Ryom> Get-Module vmware.powercli -ListAvailable | Select Name,Version
    
    Name            Version
    ----            -------
    VMware.PowerCLI 12.6.0.19610541
    VMware.PowerCLI 12.5.0.19195797
    VMware.PowerCLI 11.4.0.14413515
    VMware.PowerCLI 11.2.0.12780525
    
    Measure-Command -Expression { Import-Module -Name VMware.PowerCLI -RequiredVersion "12.6.0.19610541" }
    
    TotalSeconds      : 278,1105364
    
    Measure-Command -Expression { Import-Module -Name VMware.PowerCLI -RequiredVersion "12.5.0.19195797" }
    
    TotalSeconds      : 262,4339728
    
    Measure-Command -Expression { Import-Module -Name VMware.PowerCLI -RequiredVersion "11.4.0.14413515" }
    
    TotalSeconds      : 74,7240426
    
    Measure-Command -Expression { Import-Module -Name VMware.PowerCLI -RequiredVersion "11.2.0.12780525" }
    
    TotalSeconds      : 67,2664953
    
    

     

    On a server I tried to load the module one at a time and a few takes a lot of time

    Module                                                   Time
    ------                                                   ----
    VMware.VimAutomation.StorageUtility                 0.0237571
    VMware.Sdk.vSphere.vCenter.Authentication           0.0423705
    VMware.Sdk.vSphere.vCenter.Tagging                  0.0425801
    VMware.Sdk.vSphere.vCenter.Datastore                0.0448665
    VMware.PowerCLI                                     0.0451929
    VMware.Sdk.vSphere.vCenter.Inventory                0.0586805
    VMware.Sdk.vSphere.vCenter.Topology                 0.0601896
    VMware.Sdk.vSphere.Appliance.LocalAccounts          0.0611476
    VMware.Sdk.vSphere.vCenter.Services                 0.0662093
    VMware.Sdk.vSphere.vCenter.ISO                      0.0757836
    VMware.Sdk.vSphere.Appliance.SupportBundle          0.0801645
    VMware.Sdk.vSphere.Appliance.InfraProfile           0.0836443
    VMware.Sdk.vSphere.Esx.Hosts                        0.0867051
    VMware.Sdk.vSphere.Appliance.Logging                0.0883229
    VMware.Vim                                          0.0889236
    VMware.Sdk.vSphere.vCenter.SystemConfig             0.0953826
    VMware.VimAutomation.HorizonView                    0.1007856
    VMware.Sdk.vSphere.vCenter.Storage                  0.1070026
    VMware.Sdk.vSphere.Esx.Hcl                          0.1151406
    VMware.Sdk.vSphere.Cis                              0.1480648
    VMware.VimAutomation.Vds                            0.1524455
    VMware.VimAutomation.Cis.Core                       0.1614397
    VMware.Sdk.vSphere.vCenter.Content                  0.1650934
    VMware.Sdk.vSphere.Appliance.System                 0.1671481
    VMware.Sdk.vSphere.vCenter.Identity                  0.170551
    VMware.Sdk.vSphere.Appliance.Health                 0.1716901
    VMware.PowerCLI.VCenter.Types.CertificateManagement 0.1801069
    VMware.Sdk.vSphere.Appliance.Update                 0.1814902
    VMware.Sdk.vSphere.Appliance.Access                 0.1886259
    VMware.ImageBuilder                                 0.1890449
    VMware.Sdk.vSphere.vCenter.OVF                      0.2169832
    VMware.PowerCLI.VCenter.Types.ApplianceService      0.2170538
    VMware.VimAutomation.Storage                        0.2245577
    VMware.VumAutomation                                0.2367201
    VMware.PowerCLI.Sdk.Types                           0.2523649
    VMware.VimAutomation.Sdk                            0.2636116
    VMware.VimAutomation.Core                           0.2699398
    VMware.VimAutomation.WorkloadManagement             0.2792913
    VMware.VimAutomation.Hcx                            0.2815501
    VMware.Sdk.vSphere.vStats                           0.2862972
    VMware.VimAutomation.License                        0.3136145
    VMware.Sdk.vSphere.vCenter.CertManagement           0.3187775
    VMware.Sdk.vSphereRuntime                           0.3201099
    VMware.Sdk.vSphere.vCenter.LCM                      0.3300182
    VMware.DeployAutomation                             0.3309094
    VMware.VimAutomation.Security                       0.3375933
    VMware.VimAutomation.Nsxt                           0.3383425
    VMware.Sdk.vSphere.VAPI.Metadata                    0.3522624
    VMware.VimAutomation.Srm                            0.3684282
    VMware.VimAutomation.vROps                            0.39676
    VMware.Sdk.vSphere.Appliance.Recovery               0.3988226
    VMware.Sdk.vSphere.vCenter.Namespaces               0.4143348
    VMware.VimAutomation.Cloud                           0.425574
    VMware.Sdk.vSphere.Content                          0.4635569
    VMware.Sdk.vSphere.vCenter.VmTemplate               0.4640392
    VMware.VimAutomation.Vmc                            0.4923164
    VMware.Sdk.vSphere.Appliance.Networking             0.4950173
    VMware.Sdk.vSphere.vCenter.VCHA                     0.4951989
    VMware.Sdk.vSphere.Cis.Tagging                      0.5196844
    VMware.Sdk.vSphere.vCenter.Guest                    0.5310759
    VMware.Sdk.vSphere.Appliance                        0.5769951
    VMware.Sdk.vSphere.vCenter.Deployment               0.6097286
    VMware.Sdk.Runtime                                  0.6110706
    VMware.PowerCLI.Sdk                                 0.8211381
    VMware.Sdk.vSphere.ContentLibrary                   0.9063722
    VMware.Sdk.vSphere.vCenter.TrustedInfrastructure    1.0054721
    VMware.Sdk.vSphere.vCenter                          1.0812165
    VMware.Sdk.vSphere.Esx.Settings                      1.419175
    VMware.Sdk.vSphere.vCenter.NamespaceManagement      1.5016791
    VMware.PowerCLI.VCenter                             2.1183928
    VMware.Sdk.vSphere.vCenter.Vm                       2.5200824
    VMware.Sdk.Nsx.Policy                                5.344489
    VMware.Sdk.vSphere                                  5.6683524
    VMware.VimAutomation.Common                         5.7150553
    
    
    PS> $Output2.time | Measure-Object -sum
    
    
    Count    : 75
    Average  :
    Sum      : 43.9600246
    Maximum  :
    Minimum  :
    Property :

     

    Is there anyway to disable module that are not needed, to speed things up?



  • 2.  RE: PowerCli load time is insane

    Posted May 20, 2022 08:55 PM

    I think that I asked you in another of your threads why you do an

     

    Import-Module -Name VMware.PowerCLI

     

    in a script.

    If your PowerCLI modules are in a folder listed in $env:PSModulePath there is absolutely no need for that.
    The PS engine will load the required module the first time you use a cmdlet from that module.

    Also note that since PowerCLI 12.4 (or 12.5) there have been a lot of new modules added, all starting with 'VMware.Sdk.vSphere.'.
    And which you probably aren't using.
    Those added modules explain part of the additional load time when you do that Import-Module -Name VMware.PowerCLI in a script.

    The only reason why I might load a module explicitly is when my script uses a Type that is defined in that module (before it uses a cmdlet from that module).
    Unfortunately, the PS engine does not automatically load modules on use of a Type.