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 (286k 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

In a business rule, I'd like to pass Adaxes variables into a powershell script that I'll run. For example, pass %username% into the script so it can be used inside the script.

asked Sep 5 by P-Sysadmin (20 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

We use Server 2022 Active Directory Domain Services with the new LAPS Password Management system. Access to the old ms-Mcs-AdmPwd is no longer a valid option for displaying the ... ADaxes Just a little history - I have been using Adaxes and LAPS since 2012.

asked Aug 21 by George.Holden (60 points)
3,519 questions
3,209 answers
8,181 comments
547,559 users