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
Script signing and building to exe
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.
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.
Re: Script signing and building to exe
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.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8489
- Last visit: Thu Apr 18, 2024 1:15 pm
- Been upvoted: 37 times
Re: Script signing and building to exe
Please specify what script engine exactly you are using.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- kevinkidder
- Posts: 5
- Last visit: Thu Oct 26, 2023 8:27 am
Re: Script signing and building to exe
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
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
- Alexander Riedel
- Posts: 8489
- Last visit: Thu Apr 18, 2024 1:15 pm
- Been upvoted: 37 times
Re: Script signing and building to exe
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.
SAPIEN Technologies, Inc.