Security warning on compiled exe

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 2 years and 7 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.
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Security warning on compiled exe

Post by Terryeaglebgc »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: sapien powershell studio 5.8.191.0
Operating system: windows 10 2004
PowerShell version(s): 5.1.18362.1171

Hi there, after i compiled my project to an EXE I get a warning about warning about script security. please see attached. How can this be avoided or configured in the EXE?

Thanks

*** Please add details and screenshots as needed below. ***

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
Attachments
exewarning.jpg
exewarning.jpg (31.33 KiB) Viewed 6528 times
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Security warning on compiled exe

Post by Alexander Riedel »

Are you running a script from within the packaged code?
How exactly have you packaged your script into an exe?
Alexander Riedel
SAPIEN Technologies, Inc.
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

Package build (CTRL +F7) then copy the exe from Projects\(project)\bin\x64

I did manifest creation (Embed a default manifest for request elevation. because the app should run with admin rights.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Security warning on compiled exe

Post by Alexander Riedel »

The dialog you see is a PowerShell security prompt for running unsigned and/or blocked scripts.
A packaged executable using a SAPIEN Script host does not execute your code as a script, so it would not cause that warning.
Hence my questions:
Are you running a script from within the packaged code?
What script engine did you package with? (Sorry if my question was not precise enough)
Alexander Riedel
SAPIEN Technologies, Inc.
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

From within Sapien see attached picture
build.jpg
build.jpg (38.48 KiB) Viewed 6488 times
file.jpg
file.jpg (27.85 KiB) Viewed 6488 times
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

Also when I click run ( non compiled version within Sapien by pushing F5) I don't get the prompts
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

do you mean this?
run.jpg
run.jpg (62.49 KiB) Viewed 6486 times
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Security warning on compiled exe

Post by Alexander Riedel »

Yes, that is what I meant.
That would not trigger that security warning.
In the code you package as an executable, do you use any external scripts or modules?
Alexander Riedel
SAPIEN Technologies, Inc.
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

I do
logging.jpg
logging.jpg (57.99 KiB) Viewed 6486 times
what if I add the other PS1 as a local file . .\logging_module.ps1?

if not what is the best way to add other ps1 files and control load order?
Terryeaglebgc
Posts: 7
Last visit: Fri Nov 12, 2021 11:21 am

Re: Security warning on compiled exe

Post by Terryeaglebgc »

I changed it to . \external.ps1 and that worked,

Thanks
This topic is 2 years and 7 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.