Last active
September 3, 2020 09:14
-
-
Save andreagx/fc9b9ea2628f67bad8f6b435608a03a9 to your computer and use it in GitHub Desktop.
DisableTeamCreation.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #AzureAD preview module needed | |
| #Before install AzureADPreview module, uninstall AzureAD Module: Uninstall-Module -Name AzureAD -Force | |
| $groupname = "TEAMS-TeamCreation" | |
| Connect-AzureAD | |
| Get-AzureADGroup -SearchString $groupname | |
| $Template = Get-AzureADDirectorySettingTemplate | where {$_.DisplayName -eq 'Group.Unified'} | |
| $Setting = $Template.CreateDirectorySetting() | |
| New-AzureADDirectorySetting -DirectorySetting $Setting | |
| $Setting = Get-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id | |
| $Setting["EnableGroupCreation"] = $False | |
| $Setting["GroupCreationAllowedGroupId"] = (Get-AzureADGroup -SearchString "Name of your security group").objectid | |
| Set-AzureADDirectorySetting -Id (Get-AzureADDirectorySetting | where -Property DisplayName -Value "Group.Unified" -EQ).id -DirectorySetting $Setting | |
| (Get-AzureADDirectorySetting).Values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment