0 votes

I am setting up a custom command to decomission users, part of the process before the AD groups are removed I want it to export a list of the groups to a network location. I can do it easily enough in powershell when specifying the user, but trying to use the %SAMAccountName% isn't working. Below is the small script I have so far to do it, can you please advise if anything is missing?

Import-Module Adaxes

$ADusername = "%SAMAccountName%"
$filedestinaton = "*file path*"

Get-admPrincipalGroupMembership $ADusername | select name | Export-Csv $filedestinaton-$ADusername.csv

I am currently getting an error "The command can be executed via an Adaxes service only." I have a security role which is allowed to run this custom command which I have added my account to, so i believe i have permission to run it.

by (400 points)


Can you provide details on how you execute the Custom Command? Do you run it manually (via the Web Interface or the Administration Console), or as a part of some other script, Custom Command, Business Rule or Scheduled Task? Is the command enabled or disabled? To check this, right-click the command and select Properties.


Right now it is it's own custom command as I wanted to just test the file logging part by itself. However I would like it to be part of a custom command that can be run manually via the web interface, and also part of a scheduled task that will run based on a users end date. While I have been testing I have been running it manually via the administration console by either the "run script" button inside the action, or by going through the "active directory" in adaxes and right clicking on the user I want to run it on -> "All tasks" -> Custom command. The command is currently enabled.

1 Answer

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


The thing is that the Get-AdmPrincipalGroupMembership cmdlet can be executed via an Adaxes service only. Thus, you need to specify an adaxes service via the -AdaxesService parameter, for example:

Get-AdmPrincipalGroupMembership $ADusername -AdaxesService localhost | select name | Export-Csv $filedestinaton-$ADusername.csv

Related questions

0 votes
0 answers

I am trying to find a way to create Groups based off an OU and a list of options (check boxes) within the portal For example: Select the Target OU to add groups ... 3 - Remote Administrators Option 3 - Remote Developers Option 4 - Readers Option 4 - Writers

asked Sep 11, 2020 by dknapp (100 points)
0 votes
1 answer

Is there a way to get the name of the user who approved a request and supply that to a step inside of a custom command? For example, HR submits a status change for an employee. ... and pass it as a param in a custom command that is called in one of the steps?

asked May 12 by davfount90 (20 points)
0 votes
1 answer

Our Help Desk currently 'mirrors' the group membership of a new user based on another existing user in our AD. I'd like to be able to automate this so that the initiator ... and 'paste' it on the new user being created. Any help on this would be appreciated!

asked Apr 21, 2020 by RayBilyk (120 points)
0 votes
1 answer

I'd like to be able to either send an email report or export a CSV of all of the business rules carried out when a user is disabled. This would be ... Management Activity section but this includes things that weren't part of the disable operation. Thanks

asked Feb 19, 2020 by bavery (150 points)
0 votes
2 answers

Adaxes team, I'm on version 2017.1 / 3.8.14218.0. I am exporting a list of users (~880) to an Excel file using the Admin Console. I am manually selecting the ... is not currently possible in the software, can I request this as a feature for a future release?

asked Jun 8, 2017 by bradenmcg (260 points)
2,493 questions
2,240 answers
414,933 users