https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-groupcreate
Active Directory - Group create
https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-groupcreate
active-directory delegated-form powershell product service-automation task
Last synced: about 1 year ago
JSON representation
Active Directory - Group create
- Host: GitHub
- URL: https://github.com/tools4everbv/helloid-task-sa-target-activedirectory-groupcreate
- Owner: Tools4everBV
- Created: 2023-03-02T15:15:44.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-09T15:14:04.000Z (about 2 years ago)
- Last Synced: 2025-01-08T10:45:43.170Z (over 1 year ago)
- Topics: active-directory, delegated-form, powershell, product, service-automation, task
- Language: PowerShell
- Homepage:
- Size: 29.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-GroupCreate
## 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:
1. Define a hash table `$formObject`. The keys of the hash table represent the properties of the `New-ADGroup` 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.
> The script provides examples of how certain fields, such as email and managedBy, need to be supplied differently to the New-ADGroup cmdlet. Although these fields are initially added in the form object, they are later modified in the script to match the properties of the New-ADGroup.
```json
{
"Name": "TestGroup1",
"Description": "TestGroup1",
"GroupCategory": "Security",
"GroupScope": "Global",
"OrganizationalUnit": "OU=Groups,DC=Tools,DC=local",
"ManagerUserPrincipalName" : "john.doe@tools.com",
"email": "TestGroup@tools.com"
}
```
> :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.
2. Imports the ActiveDirectory module.
3. Verify if the group that must be created already exists based on the `name` using the `Get-ADgroup` cmdlet.
4. If the group does not exist, a new group is created using the `New-ADgroup` cmdlet. The hash table called `$formObject` is passed to the `New-ADgroup` cmdlet using the `@` symbol in front of the hash table name. [See the Microsoft Docs page](https://learn.microsoft.com/en-us/powershell/module/activedirectory/new-adgroup?view=windowsserver2022-ps)
>