Sapien Credential Feature not working when packaged

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.
User avatar
kurtd_cobain
Posts: 7
Last visit: Tue May 31, 2022 8:26 am

Sapien Credential Feature not working when packaged

Post by kurtd_cobain »

I am having an issue where storing and using credentials in the "Packager, Credentials" is not working when I run it from the EXE.
I have set the Credentials in the 'Settings', 'Packager', Credentials' tab. When I run the project from within PowerShell Studio it works fine. But when I build and run the EXE it does not find the credentials... Does this only work within PowerShell Studio?
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Sapien Credential Feature not working when packaged

Post by brittneyr »

[Moved to PowerShell Studio forum by moderator]
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Sapien Credential Feature not working when packaged

Post by brittneyr »

Can you please answer the following questions:
-What build of PowerShell Studio do you have installed?
-What Operating System are you working on?
-What version of PowerShell are you working with?
-What type of engine are you packaging with in SAPIEN Script Packager?


You may find the following helpful:
https://www.sapien.com/blog/2022/01/24/ ... your-code/
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
kurtd_cobain
Posts: 7
Last visit: Tue May 31, 2022 8:26 am

Re: Sapien Credential Feature not working when packaged

Post by kurtd_cobain »

brittneyr wrote: Mon May 16, 2022 7:57 am Can you please answer the following questions:
-What build of PowerShell Studio do you have installed?
-What Operating System are you working on?
-What version of PowerShell are you working with?
-What type of engine are you packaging with in SAPIEN Script Packager?


You may find the following helpful:
https://www.sapien.com/blog/2022/01/24/ ... your-code/
I had previously read that blog and that's how I found out about this new feature.

PowerShell Studio Version = 2022 5.8.206
Windows 10 Pro 21H2
PSVersion 5.1.19041.1682
Script Engine = Windows PowerShell > SAPIEN PowerShell V5 Host (Windows Forms) > 64-Bit
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Sapien Credential Feature not working when packaged

Post by brittneyr »

I have not been able to replicate this behavior with the latest build of PowerShell Studio.
Please try clearing the output folder and try rebuilding. Verify that the executable was recreated.

Are you able to see your credentials if you output them in a messagebox in the script and then rebuild the executable?
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
kurtd_cobain
Posts: 7
Last visit: Tue May 31, 2022 8:26 am

Re: Sapien Credential Feature not working when packaged

Post by kurtd_cobain »

brittneyr wrote: Mon May 16, 2022 11:19 am I have not been able to replicate this behavior with the latest build of PowerShell Studio.
Please try clearing the output folder and try rebuilding. Verify that the executable was recreated.

Are you able to see your credentials if you output them in a messagebox in the script and then rebuild the executable?
I just tried a PowerShell script and it is capable of showing the stored credentials with a packaged exe. However, I'm still unable to replicate that success with a script running in a form. It will only show the credentials when run interactively in PowerShell studio. And, I did clear the output folder and rebuilt it.
User avatar
Alexander Riedel
Posts: 7996
Last visit: Fri Jun 24, 2022 8:22 am
Answers: 12
Been upvoted: 24 times

Re: Sapien Credential Feature not working when packaged

Post by Alexander Riedel »

Please post the code you use to retrieve the stored credentials and indicate where exactly in the form based code you do that.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
kurtd_cobain
Posts: 7
Last visit: Tue May 31, 2022 8:26 am

Re: Sapien Credential Feature not working when packaged

Post by kurtd_cobain »

Alexander Riedel wrote: Mon May 16, 2022 1:11 pm Please post the code you use to retrieve the stored credentials and indicate where exactly in the form based code you do that.
I'm just testing it so it's quite simple. I'm only trying to retrieve the password:

$form1_Load={
$test = $SAPIENHost.GetPasswordString(0)
$textbox1.Text = $test
}
User avatar
brittneyr
Site Admin
Posts: 1126
Last visit: Tue Jun 21, 2022 3:31 pm
Answers: 25
Been upvoted: 20 times

Re: Sapien Credential Feature not working when packaged

Post by brittneyr »

Are you building for executable from PowerShell Studio or SAPIEN Script Packager?

If the former, can you please open the Packager settings (Deploy->Packager) and try building from there?
Brittney Ryn
SAPIEN Technologies, Inc.
User avatar
kurtd_cobain
Posts: 7
Last visit: Tue May 31, 2022 8:26 am

Re: Sapien Credential Feature not working when packaged

Post by kurtd_cobain »

brittneyr wrote: Mon May 16, 2022 2:17 pm Are you building for executable from PowerShell Studio or SAPIEN Script Packager?

If the former, can you please open the Packager settings (Deploy->Packager) and try building from there?
When I build it from Deploy > Installer section > Settings > Build Package it does work
When I build it from Deploy > Packager section > Settings > Build Package (or build) it doesn't work