https://github.com/tools4everbv/helloid-task-sa-source-activedirectory-accountsearch
Active Directory - User account search
https://github.com/tools4everbv/helloid-task-sa-source-activedirectory-accountsearch
active-directory data-source powershell service-automation
Last synced: 11 months ago
JSON representation
Active Directory - User account search
- Host: GitHub
- URL: https://github.com/tools4everbv/helloid-task-sa-source-activedirectory-accountsearch
- Owner: Tools4everBV
- Created: 2023-12-19T07:51:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-31T08:42:48.000Z (over 2 years ago)
- Last Synced: 2025-02-25T22:11:39.820Z (over 1 year ago)
- Topics: active-directory, data-source, powershell, service-automation
- Language: PowerShell
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HelloID-Task-SA-Source-ActiveDirectory-AccountSearch
## Prerequisites
- [ ] The HelloID SA on-premises agent installed
- [ ] The ActiveDirectory module is installed on the server where the HelloID SA on-premises agent is running.
- [ ] User-defined variable `ADusersSearchOU` created in your HelloID portal. Containing a Json string array of Active Directory OU's to search in.
Example value
```json
[{ "OU": "OU=Disabled Users,DC=helloid,DC=local"},{ "OU": "OU=Users,DC=helloid,DC=local"},{"OU": "OU=External,DC=helloid,DC=local"}]
```
## Description
This code snippet executes the following tasks:
1. Imports the ActiveDirectory module.
2. Define a wildcard search query `$searchQuery` based on the search parameter `$datasource.searchUser`
3. Loop through the list of AD search OU's defined in the User-defined variable `ADusersSearchOU` and retrieve the AD users using the `Get-ADUser` cmdlet.
> The filter property **-filter** accepts different values [See the Microsoft Docs page](https://learn.microsoft.com/en-us/powershell/module/activedirectory/get-aduser?view=windowsserver2022-ps)
4. Return a hash table for each user account using the `Write-Output` cmdlet.
> To view an example of the data source output, please refer to the JSON code pasted below.
```json
{
"searchUser": "James"
}
```