Offline PowerShell module installation failure

Miles M 1 Reputation point
2022-05-12T16:53:13.497+00:00

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

Tried with -Force as well, no dice. 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.

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,602 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 56,271 Reputation points
    2022-05-12T17:43:51.25+00:00

    I'm assuming you set up a local file repository using Register-PSRepository.

    Once you've done that then pass the repository name that you created to Install-Module.

       Install-Module VMWare.PowerCLI -Scope CurrentUser -Repository MyLocalRepo  
    

  2. Miles M 1 Reputation point
    2022-05-25T19:12:46.847+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.