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 (1.9k points)
0

Hello,

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.

0

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

Scott,

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
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 by RayBilyk (480 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 by bavery (880 points)
0 votes
1 answer

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 (1.6k points)
0 votes
1 answer

There is a script to indicated if a user is a member of any listed groups. Is it possible to have a version of the script that checks a group or member of any nested group? Current script page: https://www.adaxes.com/script-repositor ... s-s294.htm

asked Apr 30, 2018 by adaxes_user (2.1k points)
0 votes
1 answer

Hello, I have a web service that checks if a user is a member of a group. I am not concerned if they are a direct member or an indirect member of a group, but if the user is in the ... I pass it User A and Group 1. I am using ADSI, c# (.Net 4.0), and WCF.

asked Feb 23, 2014 by mbcalvin (1.1k points)
2,251 questions
2,011 answers
5,505 comments
24,704 users