powershellpowerclipowershell-module

Offline PowerShell module installation failure (PowerCLI)


I've seen numerous posts on the subject but none that offered a solution to my specific case so trying here.

I am trying to install VMWare's PowerCLI module into PowerShell on an offline Windows 10 box (21H1). I already obtained the unpacked PowerCLI Module folders (and the files are directly in them as opposed to nested within a version folder) and moved to the offline box. I was also able to install NuGet and also upgrade PowerShellGet from 1.0.0.1 to 2.2.5. Doing both of the above resolved several errors I was getting before but now faced with a brick wall here.

When I go to import the PowerCLI modules I then get "Warning: Unable to find module repositories" which makes sense as I am on an offline machine. I tried creating one locally and dumped all the modules there and ever registered the new local repo but all I get is:

PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'VMWare.PowerCLI'. Try Get-PSRepository to see all available registered module repositories.
    At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:9711 char:34
    + ... talledPackages = PackageManagement\Install-Package @PSBoundParameters
    +                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
        + FullyQualifiedErrorId :  NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

The actual command I run to import is:

Install-Module VMWare.PowerCLI -Scope CurrentUser

I have a feeling it has to do with the local repo but unsure how to resolve. Are the modules not supposed to go directly in there? They are also in my "..\WindowsPowershell\Modules" folder and that is also set in the PSModulePath but nothing appears to work still and all point to above error. Note: this box cannot touch the internet so if I have to obtain additional files, dlls, whatever I can do so separately but the import has do be done offline. Running PowerShell 5. Any help would be much appreciated.


Solution

  • In case anyone runs into this issue what resolved it for me was simply running

    Get-ChildItem -Path "Your_module_folder" -Recurse | Unblock-File
    

    and everything worked fine after.