Open jakerobinson opened 7 years ago
@jakerobinson Yes, the workaround is to use Save-Module on PS 4 or 3.
Option: -NoVersionFolder switch parameter can be added on Save-Module cmdlet to not create the version folder on PS 5 or newer. Thoughts?
That sounds like a perfect solution. :)
Also, how deep does this go? I am trying to find where that path gets added, and install-package
from OneGet has the same behavior. I am guessing it is even deeper in the PackageProvider? What is actually putting that version into the path, and where do we want to remove it?
Took a crack at this tonight and failed.
After module restructure, the offending lines are now:
As far as I can tell, the flow from Save-Module
is something like:
Save-Module
> PackageManagement\Save-Package
> [unknown]
> Download-Package
> Install-PackageUtility
I'm not sure how to persist the -NoVersionFolder
parameter flowing out of and back into this module.
Hopefully this info helps the next person make this happen.
Save-Module
downloads modules including a version folder in the path. Older versions of Powershell don't know how to import modules with a version in the folder path, and requires users to manually move around files to get the modules to work.A user has provided details and a workaround here: http://www.powershellcrack.com/2017/09/installing-powercli-on-disconnected.html
See also: https://communities.vmware.com/thread/564258
Edit: Adding more info to save people time when they read this. :)
The problematic workflow is this:
A user has PS 5.x on their machine connected to the Internet, and PS <5.0 on their machine not connected to the Internet. They want to install modules from the gallery on their non-connected machine.
Save-Module
to get module from gallery. (Saved with version folders in path).