Powershell app can be used to retrieve the custom attributes of an Active Directory user using the Active Directory commandlets.
Get-ADUser -Identity akash.hirve -Properties slackid | ConvertTo-Json
The Get-ADUser commandlet in Powershell is used to retrieve the Active Directory user details. The response is converted to a JSON object, then parsed using the JSON parser node in the Automator. The parsed outputs can then be used in subsequent nodes in the Automator.
Note: To use ActiveDirectory cmdlets, enter AD credentials while installing the Powershell Orchestration app.
The custom attribute “slackid” is specified in the “-Properties” option for the “Get-ADUser” commandlet. Additional custom properties can be specified in a comma-separated format.
Step 1: Fetch details of an Active Directory user with Get-ADUser commandlet
Note: Installation parameters/credentials are for the active directory domain controller.
Step 2: Test the action and copy the sample response body to the clipboard.
Step 3: Drag and drop the JSON Parser node onto the canvas
Step 4: Map the Source to the output of the Powershell App action
Step 5: Paste the sample response body into the Payload section and hit the Generate Output button to automatically create the outputs based on the schema of the payload input.
Optional: If you require any other values from the schema at runtime, you can also create your outputs with custom JSON Path expressions.
Step 6: Reference any outputs configured in the Parser nodes in subsequent conditions and actions going forward.