https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-accountmove
Active Directory - User account move
https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-accountmove
active-directory delegated-form powershell product service-automation task
Last synced: 12 months ago
JSON representation
Active Directory - User account move
- Host: GitHub
- URL: https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-accountmove
- Owner: Tools4everBV
- Created: 2023-03-03T08:45:18.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T15:11:41.000Z (over 2 years ago)
- Last Synced: 2025-02-25T22:13:40.311Z (over 1 year ago)
- Topics: active-directory, delegated-form, powershell, product, service-automation, task
- Language: PowerShell
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# HelloID-Task-SA-Target-ActiveDirectory-AccountMove
## 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.
## Description
This code snippet executes the following tasks:
This code snippet will move a user from Active Directory to a specified organizational unit and executes the following tasks:
1. Define a hash table `$formObject`. The keys of the hash table represent the properties of the `Get-ADUser` cmdlet, while the values represent the values entered in the form.
> To view an example of the form output, please refer to the JSON code pasted below.
```json
{
"UserIdentity": "testuser@mydomain.local",
"TargetOu" : "OU=ou2,OU=development,DC=mydomain,DC=local"
}
```
> :exclamation: It is important to note that the names of your form fields might differ. Ensure that the `$formObject` hashtable is appropriately adjusted to match your form fields.
> The field **UserIdentity** accepts different values [See the Microsoft Docs page](https://learn.microsoft.com/en-us/powershell/module/activedirectory/move-adobject?view=windowsserver2022-ps#description)
2. Imports the ActiveDirectory module.
3. Verifies that the account that must be deleted exists based on the `UserIdentity` using the `Get-ADUser` cmdlet.
4. If the user does exist, the account is moved using the `Move-ADObject` cmdlet, otherwise an warning is generated.