Script signing and building to 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 3 years and 11 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
kevinkidder
Posts: 5
Last visit: Thu Oct 26, 2023 8:27 am

Script signing and building to exe

Post by kevinkidder »

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:PrimalScript 7.6.138
32 or 64 bit version of product: x64
Operating system: Windows 10 Enterprise
32 or 64 bit OS:x64

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

When I build a signed PS1 script in to an EXE file, when the EXE is run, the extracted script code(which has a random name) isn't signed. Is there a way to change this? Maybe I am just missing a setting.

Thanks
Kevin

DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 11:13 am
Answers: 39
Been upvoted: 30 times

Re: Script signing and building to exe

Post by brittneyr »

By extracted script, are you writing out a script that was packaged into an exe? If so, the script being written out will need to be signed again.
Brittney
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Script signing and building to exe

Post by Alexander Riedel »

Please specify what script engine exactly you are using.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
kevinkidder
Posts: 5
Last visit: Thu Oct 26, 2023 8:27 am

Re: Script signing and building to exe

Post by kevinkidder »

The original script written is in Powershell. Let's call it script1.ps1. That script is signed. I use PrimalScript to build it to an exe file. When the EXE executes, powershell engine is seen running a script called <randomname>.ps1. This script won't run because script signing is enforced on the workstation.

Below is the output of a script. The PS1 is called "Qualys-ScanNow.ps1" and it is signed. The EXE file that is built has the same name (Qualys-ScanNow.exe) When I run the exe file, I get the message:

[15:12:00]:Qualys-ScanNow$ .\Qualys-ScanNow.exe
Qualys-ScanNow\1453F3E.ps1 : File
Qualys-ScanNow\1453F3E.ps1 cannot be loaded. The file
Qualys-ScanNow\1453F3E.ps1 is not digitally signed. You cannot run this script on the
current system. For more information about running scripts and setting execution policy, see about_Execution_Policies
at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Qualys-ScanNow\1453F3E.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Script signing and building to exe

Post by Alexander Riedel »

Let me rephrase that. What Script Engine did you select when packaging the script? Is there any particular reason you did not use any of the SAPIEN Host engines?
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 3 years and 11 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.