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

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

asked Jan 27 by samuel.anim-addo (20 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

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)
2,995 questions
2,714 answers
6,997 comments
205,328 users