Include Powershell Modules

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
danarstevenson
Posts: 8
Last visit: Wed Mar 20, 2024 5:41 am

Include Powershell Modules

Post by danarstevenson »

Greetings,

PowerShell Studio 2018 v5.5.148
On Windows 2012 R2.

First of very new to PowerShell Studio but its helping allot already.

I would like to include the powercli modules in a project build that i can give to our desktop support to create a VM based on some preconfigured options. I would like not have to install Powercli on the target machine.

From what i read so far was to check the box under cache , and rebuild cache. I did this and confirmed that the PowerCLI modules were selected. I must be missing a step to include the modules or i don't understand if you can include PowerShell modules in the exe build so I dont have to have them installed on the target machine.

Please help
Thank you
Dana
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Include Powershell Modules

Post by davidc »

[TOPIC MOVED TO THE POWERSHELL STUDIO PRODUCT SUPPORT FORUM BY MODERATOR]

Note: The module cache is used for PrimalSense and syntax coloring only. It has no bearing on the packager.

PowerShell Studio packager does not embed modules into the executable. Including third party modules into the executable could result in issues, especially if the module has external dependencies (such as binary assemblies).
In addition, embedding and extracting files in an executable is frowned upon by Microsoft and they recommend using MSI installers.

Here are some alternatives:
- If the module is up on the PSGallery, I would recommend adding code to your script that will allow users to download the necessary module(s).
- If you know it is a standalone module (and you have permission to redistribute it), you can try creating an MSI installer for your executable and include the module in a sub-folder. Then have your script reference the module from the sub-folder or move it into a PSModulePath location if the module isn't already installed.
David
SAPIEN Technologies, Inc.
User avatar
danarstevenson
Posts: 8
Last visit: Wed Mar 20, 2024 5:41 am

Re: Include Powershell Modules

Post by danarstevenson »

Thank you.
This topic is 6 years and 1 month old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.