Page 1 of 1

Embedded Credentials Question

Posted: Wed Nov 23, 2022 8:01 am
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)

Re: Embedded Credentials Question

Posted: Wed Nov 23, 2022 10:04 am
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

Re: Embedded Credentials Question

Posted: Wed Nov 23, 2022 11:37 am
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