PowerCLI

 View Only
Expand all | Collapse all

PowerCLI on air gapped machine

  • 1.  PowerCLI on air gapped machine

    Posted Jun 05, 2023 03:49 PM

    Hello,

    I am importing the PowerCLI on my machine that as no internet connection, and it takes 8 min to load.

    I have tried the various "old" trick found to speed it up without effect. (Import-Module VMware.PowerCLI" Takes 5 Minutes  )

    Can someone help me, this is really annoying  ? 

     



  • 2.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 04:20 PM

    Why do you import all PowerCLI modules at all?
    PS loads the correct modules for you the moment you use the 1st cmdlet in a module.



  • 3.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 04:58 PM

    I do not have admin privileges on my workstation.

    So I use Import-Modules ... is there a way to install-modules as a regular user ?



  • 4.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 06:15 PM

    Sorry, not following.
    I don't see what Import_Module has to do with Install-Module.
    When the PowerCLI modules are installed, and the folder where they are installed is in your $env:PSMOdulePath, you can use the PowerCLI cmdlets



  • 5.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 06:47 PM

    Sorry for not being clear.

    I do not have admin privilege on the machine I am using.

    Therefor I cannot Install-Module.

    But I can perform Import-Module once I have started my PowerShell session. It all works, it's just very long (8 min to import the modules), once it's imported, all is fine.

    But I have to import-module each time I start a new PowerShell.

     



  • 6.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 06:51 PM

    I suspect you might not have read my 1st reply.
    There is no need to run

    Import-Module -Name VMware.PowerCLI

    PowerShell will load the required module(s) automatically when the 1st cmdlet from that module is used.
    With the import you are doing, all PowerCLI modules are loaded, also the ones that you are not using.
    Since PowerCLI comes with a lot of modules, that loading will take some time.



  • 7.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 06:53 PM

    Thank you very much for your support  ...

    again, the module are not installed on my machine, I don't have the privilege to do so.

    So, no the modules / cmdlets are not available... until I import them 

     



  • 8.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 07:24 PM

    How can you import modules that are not installed?
    Importing doesn't install modules.

    I'm not sure what exactly you are doing and how that environment is set up.



  • 9.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 07:47 PM

    I download the VMware-PowerCLI-13.1.0-21624340.zip from https://developer.vmware.com/

    I copy it to my machine (this machine does not have internet access)

    unzip it to a folder c:\users\PhSLU\Download\VMware-PowerCLI for exemple 

    then launch PowerShell

    $env:PSModulePath +=;C:\users\PhSLU\Download\VMware-PowerCLI

    import-module c:\users\PhSLU\Download\VMware-PowerCLI\VMware-PowerCLI

     



  • 10.  RE: PowerCLI on air gapped machine
    Best Answer

    Posted Jun 05, 2023 08:15 PM

    If your environment variable PSModulePath persists between session there should be no need to repeat that line every session.
    Once the module cache is build by PS, the module autoload should load the required modules.
    There is no need to load all PowerCLI modules, which is what you are doing by doing an Import of VMware.PowerCLI



  • 11.  RE: PowerCLI on air gapped machine

    Posted Jun 05, 2023 08:44 PM

    will try that. 

     



  • 12.  RE: PowerCLI on air gapped machine

    Posted Jun 06, 2023 06:38 AM

    Adding the directory to $env:PSModulePath in my $profile, and the cmdlet are available