0 votes

Hi

I'm trying to use the credentials of the service administrator in a PS script, but i'm having problems:
"Cannot bind argument to parameter 'String' because it is null. Stack trace: at <ScriptBlock>, <No file>: line 6"

Using the example from the guides:
$username = $Context.RunAs.UserName
$password = ConvertTo-SecureString $Context.RunAs.Password -AsPlainText -Force

The error refers to the line containing $password.

Any ideas?

by (960 points)

1 Answer

0 votes
by (270k points)
selected by
Best answer

Hello,

Most probably, the issue occurs because the Adaxes service account option is selected in the Run as section. To use the $Context.RunAs property in your script, you need to select This account and specify the account whose credentials will be used in the script.

Related questions

0 votes
1 answer

When running a PowerShell script as an action in a custom command, you can set the script to run as a different account and then use the RunAs property in the ... Is there another way to get the Adaxes service account's credentials from within the script?

asked Mar 31, 2022 by KelseaIT (320 points)
0 votes
1 answer

Hi All, I am currently using the 30 day free trial of Adaxes and seeing if we can use it to achieve our method of user provisioning. I am looking into server-side ... variable value within an SQL query Can this be achieved? Any help is much appreciated, Thanks

asked Feb 1 by Lewis (40 points)
0 votes
1 answer

Hello, we want to setup a scheduled report with all our teams (security groups) and their respective team-leader (specified in "managedBy" of security group). I get the name of ... the team-leader. And this is my problem... Can you help me with this problem?

asked Oct 9, 2020 by lohnag (140 points)
0 votes
1 answer

Hi, I would need to set a random plaintext in the header of the login page of one of the contexts (via custom HTML). This plaintext must be aligned with a ... . This would serve as a pseudo verification code for entering in the console. Thanks, Daniele

asked May 26, 2020 by dmaggiolo (20 points)
0 votes
1 answer

I'd like to run code against the Adaxes service but need to pass my Admin credentials. How do I send different creds than the current user?

asked Jul 27, 2020 by ComputerHabit (790 points)
3,326 questions
3,026 answers
7,727 comments
544,681 users