Product: PowerShell Studio 2022 (64 Bit)
Build: v5.8.207
OS: Windows Server 2019 Datacenter (64 Bit)
Build: v10.0.17763.0
PSVersion: 5.1.17763.2931
I'm trying to package an with a PowerShell script that need passwords provided
It didn't work - here's a simple example with no real credentials (script1.png)
Write-Host User: $SAPIENHost.GetUserID(0)
Write-Host Pass: $SAPIENHost.GetPasswordString(0)
Nothing fancy...
Here's where the UserID and PasswordString are configured in the build (script2.png)
And the results (script3.png) once the exe is built
You cannot call a method on a null-valued expression.
At C:\Windows\system32\43449C22.ps1:13 char:1
+ Write-Host User: $SAPIENHost.GetUserID(0)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Windows\system32\43449C22.ps1:14 char:1
+ Write-Host Pass: $SAPIENHost.GetPasswordString(0)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Aside: this script works fine
$var_id = "newUserName"
$var_pw = "PASSWORD OBFUSCATED"
Write-Host User: $var_id
Write-Host Pass: $var_pw
Using embedded credentials in PowerShell
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.
-
- Posts: 1
- Last visit: Tue Jun 28, 2022 2:59 pm
Re: Using embedded credentials in PowerShell
Does your script work as expected when you run it in PowerShell Studio?
Brittney
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Using embedded credentials in PowerShell
From this error: At C:\Windows\system32\43449C22.ps1:13 char:1
I can tell that you selected a script engine that uses a temporary file and not one with a SAPIEN Script Host.
In all likelihood this one: So the variable $SAPIENHost does not exist in this case.
Only hosts with the words 'SAPIEN' and 'Host' have that particular object.
I can tell that you selected a script engine that uses a temporary file and not one with a SAPIEN Script Host.
In all likelihood this one: So the variable $SAPIENHost does not exist in this case.
Only hosts with the words 'SAPIEN' and 'Host' have that particular object.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.