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 (279k 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 have to do a weekly Inactiviy Report for Accounts that have not logged in for 30 days or more. 1 of the reports is for Internal users BUT there is an Account ... Adaxes and working on the product, and i need to get all my reporting done through Adaxes

asked Nov 14, 2022 by dtorannini (80 points)
3,434 questions
3,130 answers
7,984 comments
546,352 users