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

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)
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

Is there a way to have a Scheduled Task with 4 different condition? I want to create a scheduled task start every Monday and the condition see: The next Saturday of the week ... of the week is the fifth of the month then no action Thanks in advance, Simone

asked Jan 18 by Simone.Vailati (270 points)
0 votes
1 answer

I have a dropdown-field on the web surface, which is populated by a script. The script looks up all groups in a specific OU and displays them. In the Property Pattern ... random order. What should i do to show the groups in alphabetical order in the portal?

asked Sep 15, 2020 by lohnag (100 points)
2,759 questions
2,492 answers
6,531 comments
1,473,465 users