Page 1 of 2

Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 5:05 am
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?

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 7:54 am
by brittneyr
[Moved to PowerShell Studio forum by moderator]

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 7:57 am
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/

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 9:57 am
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

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 11:19 am
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?

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 12:58 pm
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.

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 1:11 pm
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.

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 1:18 pm
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
}

Re: Sapien Credential Feature not working when packaged

Posted: Mon May 16, 2022 2:17 pm
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?

Re: Sapien Credential Feature not working when packaged

Posted: Tue May 17, 2022 4:30 am
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