0 votes

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 ExecuteScriptContext to access those credentials within the script which is super helpful. So if you needed to know the username in the script, you could do $Context.RunAs.UserName.

I'm curious if there's a way to do the same thing when the script is set to run as the Adaxes service account by default without setting it to explicitly run as that account such as in the screen shot below. image.png

When I try to do $Context.RunAs.Password and $Context.RunAs.Username when the sript is set to run as the Adaxes service account, they both resolve to null. Is there another way to get the Adaxes service account's credentials from within the script?

by (320 points)

1 Answer

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

Hello,

This behavior is by design. The only way to get the Adaxes service account credentials in a script is to first specify the credentials in the This account option of the Run as section just like you mentioned doing for other accounts.

Related questions

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)
0 votes
1 answer

Hi, In the SDK I find information on how to use Powershell to read and create scripts in custom commands and business rules, but I can not find the same for ... information like the embedded scripts for the report and custom columns? -- Morten A. Steien

asked Jul 27, 2023 by Morten A. Steien (300 points)
0 votes
1 answer

For instance to execute a powershell script that enable MFA for all member in that group?

asked Jan 27, 2023 by samuel.anim-addo (20 points)
0 votes
1 answer

Hello, We're working with Adaxes for about 2 months and we can't seem to find out how we can check if a action in Adaxes worked or not. We have a ... action failed and react to it and is there something similiar to $ErrorActionPreference for adaxes actions?

asked Nov 14, 2019 by PGstoehl (100 points)
0 votes
1 answer

I'm working on user deprovision and need to re-assign a user's home directory to the manager's home directory after disabling. I found a PowerShell script on this site to ... retrieve the same for the Manager? I'm a PowerShell novice, so excuse my ignorance.

asked Feb 26, 2021 by mkvidera (60 points)
3,326 questions
3,026 answers
7,727 comments
544,678 users