This data source will allow you to list all of your Active Directory OUs inside of a dynamic form. This is useful for selecting a destination OU during user or group creation, or when moving objects from one OU to another.
Create the data source task
- Navigate to Automation > Tasks.
- Create a new custom PowerShell task and name it "DataSource: List all Active Directory OUs"
- Select an appropriate agent pool to run the task.
- In the Task tab, deselect Use template.
- Paste in the following script and save the task.
# Get a list of all OUs $objects = Get-ADOrganizationalUnit -Filter * -Properties CanonicalName | Select DistinguishedName,Name,ObjectGUID,CanonicalName; # Return the OUs to HelloID foreach($item in $objects) { $row = @{} $item.psobject.properties | Foreach { $row[$_.Name] = $_.Value.ToString() } Hid-Add-TaskResult -ResultValue $row }
Create the data source
- Navigate to Self Service > Data sources.
- Create a new data source with the name "Active Directory OUs"
- In the Type dropdown, select Task Data Source.
- In the dropdown that appears, select your previously created data source task and click Execute task.
- When a result is returned by the task, click Suggest a model.
- Save the data source.