Custom Orchestration Activity - Query AD for Groups User is a Member Of

Steven Parker
Giga Sage

So we use Orchestration for a few things in our instance.  We use the out of the box Add User to Group, Update AD Object, another custom activity, etc...

What I am trying to do now is a custom Powershell command to pull back the names of the groups a user belongs to in AD.  Here is what I'm trying:

find_real_file.png

I've tried the following as well:

Get-ADPrincipalGroupMembership ${activityInput.username} | select name

Get-ADPrincipalGroupMembership -server ldap.*****.******* -identity ${activityInput.username} | select name

 

I keep getting "The RPC Server is unavailable".  We are using the same Orchestration server we use for everything else...the same credentials for AD that we use for everything else.  Why am I getting "The RPC Server is unavailable"?  Below is the error, and it is using the correct service account for credentials:

find_real_file.png


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven
1 ACCEPTED SOLUTION

Community Alums
Not applicable

On the Outputs screen you define the output variable as activityOutput.Output1, so you will probably need to use: 

var ADGroupOutput = data.get(16).Output1;
workflow.scratchpad.ADActivityOutput = ADGroupOutput;
gs.log("Run Script Log: " + workflow.scratchpad.ADActivityOutput);

 

If you navigate to the Data tab on the top right of the Workflow Editor, you should be able to confirm the databus number and output variables there.  For example, for the below custom Orchestration activity, I get the output using data.get(88).answer.  

find_real_file.png

View solution in original post

18 REPLIES 18

Community Alums
Not applicable

Try setting and returning a variable.  

$name = Get-ADPrincipalGroupMembership -identity $username | select name
write-host $name 

You should also reference the Powershell variable name instead of the value.  For example, $username instead of ${activityInput.username}.

This helped thanks!  We are now getting better results.


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven

Can you check in the ecc queue for the exact error?

I remember using Pipe commands which works fine.


Please mark this response as correct or helpful if it assisted you with your question.

Can you try with Select-Object -Property Name and see if it works?

Also, does your PS script is OOB or you have modified it to get "name"" by adding pipeline | Select?

I have this getting output now, which is what I was looking for, but now I am having problems getting the output out of the activity.  

Here is the output when I use "Test Inputs" (random groups I belong to in AD)

find_real_file.png

Here is the "Outputs" tab in my activity:

find_real_file.png

 

I have a Run Script after the activity, when the activity completes successfully.  In the Run Script, I have the following:

//Getting Data from Query AD groups of User
var ADGroupOutput = data.get(16).output;
workflow.scratchpad.ADActivityOutput = ADGroupOutput;
gs.log("Run Script Log: " + workflow.scratchpad.ADActivityOutput);

It's coming back "Undefined" in the logs for my scratchpad variable. 

Why am I not getting the output out of the activity?


Please mark this response as correct and/or helpful if it assisted you with your question.
Steven