Embedded Credentials Question

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
scoutt
Posts: 42
Last visit: Wed Nov 23, 2022 3:25 pm

Embedded Credentials Question

Post by scoutt »

Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.212
OS: Windows 10 Pro (64 Bit)
Build: v10.0.19044.0

Can I get some clarification on using embedded credentials in a packaged script? I have added my user name and password to the credentials in settings, packaged it up and ran it outside studio, the username was empty. Code below

I then found this
https://www.sapien.com/blog/2022/01/24/ ... your-code/
with a comment below:
"Language sometime is ambiguous. It will work for packaged executables, provided you have added the credentials to the resources,"

What does Alex mean by "provided you have added the credentials to the resources," What resource? Do I have to use primal script to get this working?

I am using the Script engine as Windows forms, added username and password to the credentials and then saved packaged and then built package. But when it runs the user is empty. I am doing the exact same thing as this guy, except using Windows Forms
viewtopic.php?p=82869

Code: Select all

$login = $SAPIENHost.GetUserID(0)
$pwd = $SAPIENHost.GetPassword(0)
$winscript.popup("login: $login", 2, "Setup", 4160)
$winscript.popup("Psw: $pwd", 2, "Setup", 4160)
User avatar
Olga_B
Site Admin
Posts: 173
Last visit: Tue Nov 29, 2022 9:48 am

Re: Embedded Credentials Question

Post by Olga_B »

I checked the Embedded Credentials in my testing environment, everything is working as expected
Attached a .zip file with simple form and .psbuild file
Try to build and run it on your machine
When form is loaded, click on Load button
Attachments
Post_16112.zip
(10.58 KiB) Downloaded 8 times
User avatar
scoutt
Posts: 42
Last visit: Wed Nov 23, 2022 3:25 pm

Re: Embedded Credentials Question

Post by scoutt »

Thanks for that. It appears that it doesn't work if you have "Obfuscate PowerShell Files" checked which I did as I was testing. Uncheck the box and it gives me the credentials as expected.

Thank you