question

MilesM-4616 avatar image
0 Votes"
MilesM-4616 asked MilesM-4616 edited

Offline PowerShell module installation failure

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
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cooldadtx avatar image
0 Votes"
cooldadtx answered MilesM-4616 edited

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
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, correct. It's been created and registered and running above command to install via the local repo still gives me the error in my original post

0 Votes 0 ·

My guess is that you did not add the module to your local PS repo correctly so it cannot find it when it searches. Please provide the details of how you set up your local repo and how you added the module. It would be useful to run Find-Module -Repository MyLocalRepo to determine what modules are actually in the repo. If your module isn't listed then it wasn't added to the repo properly.

0 Votes 0 ·

Ok I'm guessing that's where the issue is then...is there more to it than adding the module folder or extracting the zip to its own folder in the repo? Is there something permissions-wise possibly needing to be added that isn't there by default?

0 Votes 0 ·
Show more comments
MilesM-4616 avatar image
0 Votes"
MilesM-4616 answered MilesM-4616 edited

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.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.