How to Package so user cannot read the ps1 files

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE 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.
This topic is 7 years and 6 months 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
RonMiller
Posts: 3
Last visit: Mon Oct 03, 2016 8:05 am

How to Package so user cannot read the ps1 files

Post by RonMiller »

Product, version and build: Powershell Studio 2016
32 or 64 bit version of product:
Operating system: Windows 10 Pro
32 or 64 bit OS: 64

We have a program that has several folders and there are PS1 files in each folder
each of the PS1 files are support files for the main program
We do not want the customer to be able to see\edit the ps1, they can not all be made as exe either
Can\How would we create a package that once it is deployed to a customer, they can not read\change any of the PS1 files
currently we are using . to link our Function PS1 to our main PS1
Is it possible with Powershell Studio 2016

Ron
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: How to Package so user cannot read the ps1 files

Post by DevinL »

The easiest way to accomplish this is to create a project and add all of the files that have your helper functions to that project, then package the project into a single executable.

Make sure to set the build options for the scripts to Include, and you can do this by changing it in the properties panel off to the right. Also, if the script that you're using only contains functions that help your primary script, set Command Extension to true:
Build_Include.png
Build_Include.png (10.57 KiB) Viewed 8998 times
Lastly, instead of dot-sourcing the files you need to reference you would use the "Call-Function" for that script that's also listed in the properties panel.
DevinL
SAPIEN Technologies, Inc.
DevinL
Posts: 1098
Last visit: Tue Jun 06, 2017 9:15 am

Re: How to Package so user cannot read the ps1 files

Post by DevinL »

You can also refer to the following blog post for information regarding how secure your scripts are when packaged in executable form:

https://www.sapien.com/blog/2010/01/19/ ... -packages/
DevinL
SAPIEN Technologies, Inc.
User avatar
RonMiller
Posts: 3
Last visit: Mon Oct 03, 2016 8:05 am

Re: How to Package so user cannot read the ps1 files

Post by RonMiller »

Thanks for your response
I attempted what you suggested but when I took it to a clean machine the exe failed
I must of done something wrong
where can I find more in depth information or video on what you suggested

Ron
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to Package so user cannot read the ps1 files

Post by davidc »

Hello Ron,

It is hard to tell what is happening without looking at the project or having an error message to go by.

1. What project type did you use? Most projects have a Startup file that contains a function called Main that serves as an entry point for the script. Make sure you place your initial script / calls here.

2. What are in these dot source files? Do they only contain function definitions? If so, set the project file's Command Extension property to True. Then remove the Call- function references and any dot source lines.

Setting Command Extension to True tells PowerShell Studio to merge the script’s contents (as is) into final script instead of wrapping it in a Call- function.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: How to Package so user cannot read the ps1 files

Post by davidc »

Looks to me that we need an article that explains how to do this.

I'm listing some articles that deal with projects. These may not directly apply, but I include them for your reference:

https://www.sapien.com/blog/2014/07/29/ ... n-project/
https://www.sapien.com/blog/2015/05/06/ ... t-options/
https://www.sapien.com/blog/2013/10/01/ ... ing-forms/
David
SAPIEN Technologies, Inc.
User avatar
RonMiller
Posts: 3
Last visit: Mon Oct 03, 2016 8:05 am

Re: How to Package so user cannot read the ps1 files

Post by RonMiller »

My current project
We have a folder Functions in them ex: NormFunc.ps1 and SpecFunc.ps1 ( they only hold functions)
in another folder Programs and we have three programs that reference the functions from the Function folders
We currently, inside each of the programs, dot source the function files and all is working ok.
My boss does not want the customer to see any of the actual code ( program or functions ) just run the exe
I can make the exe but if I remove the dot source from the program and \ or remove the functions after building the exe then it fails.

I will attempt to try this again.

Ron
This topic is 7 years and 6 months 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.