none
Copying and importing Saved Modules RRS feed

  • General discussion

  • I have a scenario where i need to package several modules up and transfer to a non internet connecting device. I need to be able to transfer these and import without setting up a separate repository. 

    Example modules FormatPx / SnippetPx 

    I can save the modules and then import on the same device if i have internet connected device. If i then copy the module folders to another device in preparation to import, part of the import fails

    The SnippetPx module will load (dependency of FormatPx) but the FormatPx module will fail with the following

    "Import-Module : No item matching "Module.Initialize.ps1" was found in the "snippets" subfolder of a module or a WindowsPowerShell

    If i review the snippets subfolder i do see that Module.Initialize.ps1 exists

    I have scanned the internet but found no resolution to this, has anyone got any ideas or step by step how to do this even if just for these two modules, i can then work on the rest

    Friday, April 6, 2018 4:48 PM

All replies

  • You would do this:

    Save-Module FormatPx -Path <path to USB device>

    On the target system:

    Copy-Item <path to usb>\FormatPx  <path to modules folder> -Recurse -force

    Example:

    Copy-Item <path to H:\FormatPx  C:\Program Files\WindowsPowerShell\Modules -Recurse -force

    Some modules require installation to register DLLs and other components.  When this is the case we set up a repository folder and use "Install-Module" to install and register the module.

    Check with the author of the modules to get the rules.  The "FormtPx" module has a DLL that may require registration.

    It appears that the "snippets" folder is only created when the module is "installed".  This indicates that you will need to set up a local repository and install th module from the repository.


    \_(ツ)_/

    Friday, April 6, 2018 5:38 PM
  • Thank you for the input, the problem was also resolved by saving the module in the same version of powershell to the target address, it was saved in version 5 PS and being tried to import on version 4.
    Tuesday, April 10, 2018 12:23 PM