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.
Locked
User avatar
kevinkidder
Posts: 5
Joined: Fri May 17, 2013 6:37 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: 501
Joined: Thu Jun 01, 2017 7:20 am

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 Ryn
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7406
Joined: Tue May 29, 2007 4:43 pm

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
Joined: Fri May 17, 2013 6:37 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: 7406
Joined: Tue May 29, 2007 4:43 pm

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.

Locked