Skip to content

Commit cc98f5b

Browse files
authored
Update manage-creation-of-groups.md
- Fixed the `Script` using the `GroupId` instead searching the Group by the `GroupName`. > [!Information] > If the script uses the option to search the group by the name, there could be more than one group by the same name and the `GroupId` could be an array.
1 parent bc90b53 commit cc98f5b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

microsoft-365/solutions/manage-creation-of-groups.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ Import-Module Microsoft.Graph.Beta.Groups
114114
115115
Connect-MgGraph -Scopes "Directory.ReadWrite.All", "Group.Read.All"
116116
117-
$GroupName = ""
118117
$AllowGroupCreation = "False"
119118
120-
$settingsObjectID = (Get-MgBetaDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).id
119+
$settingsObjectID = (Get-MgBetaDirectorySetting | Where-object -Property DisplayName -Value "Group.Unified" -EQ).Id
121120
122121
if(!$settingsObjectID)
123122
{
@@ -136,8 +135,8 @@ if(!$settingsObjectID)
136135
$settingsObjectID = (Get-MgBetaDirectorySetting | Where-object -Property Displayname -Value "Group.Unified" -EQ).Id
137136
}
138137
139-
140-
$groupId = (Get-MgBetaGroup | Where-object {$_.displayname -eq $GroupName}).Id
138+
# Get the group id of the group will be allowed to create groups from Microsoft Entra ID
139+
$groupId = ""
141140
142141
$params = @{
143142
templateId = "62375ab9-6b52-47ed-826b-58e47e0e304b"
@@ -156,7 +155,6 @@ $params = @{
156155
Update-MgBetaDirectorySetting -DirectorySettingId $settingsObjectID -BodyParameter $params
157156
158157
(Get-MgBetaDirectorySetting -DirectorySettingId $settingsObjectID).Values
159-
160158
```
161159

162160
The last line of the script will display the updated settings:

0 commit comments

Comments
 (0)