Last active
January 26, 2017 08:43
-
-
Save wictorwilen/04b4475269ff95bd274de4665ea02122 to your computer and use it in GitHub Desktop.
Office 365 Groups Creation
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
# For more information see: http://askwictor.com/2jxcYDT | |
# Store the credentials in a variable | |
$creds = Get-Credential | |
# Connect to the Microsoft Online services | |
Connect-MsolService -Credential $creds | |
# Get tenant setting (misspelled) | |
Get-MsolCompanyInformation | Format-List UsersPermissionToCreateGroupsEnabled | |
# If false, then use the following | |
Set-MsolCompanySettings -UsersPermissionToCreateGroupsEnabled $true | |
# Retrieve ID of Group that should have the option to create groups | |
$group = Get-MsolGroup -SearchString "Group creators" | |
# Retrieve the Group.Unified settings template (assuming you have not done this before) | |
$template = Get-MsolAllSettingTemplate | Where-Object {$_.DisplayName -eq "Group.Unified"} | |
# Create the settings object from the template | |
$settings = $template.CreateSettingsObject() | |
# Use this settings object to prevent others than specified group to create Groups | |
$settings["EnableGroupCreation"] = $false | |
$settings["GroupCreationAllowedGroupId"] = $groupd.ObjectId | |
# (optional) Add a link to the Group usage guidelines | |
$settings["UsageGuidelinesUrl"] = "https://contoso.sharepoint.com/Pages/GroupUsageGuidelines.aspx" | |
# (optional) Add a link to Guest usage guidelines | |
$settings["GuestUsageGuidelinesUrl"] = "http://contoso.com/usageguidelines" | |
# (optional) Add classifications to be used for Groups | |
$settings["ClassificationList"] = "Public,Internal,Top Secret" | |
# Verify | |
$settings.Values | |
# Add the settings to Azure AD | |
New-MsolSettings -SettingsObject $settings | |
################# | |
# Retrieve settings, if already created | |
$settings = Get-MsolAllSettings | Where-Object {$_.DisplayName -eq "Group.Unified"} | |
# Check the values | |
$settings.Values | |
# Update a property | |
$settings["GuestUsageGuidelinesUrl"] = "http://www.wictorwilen.se" | |
# Save the updates | |
Set-MsolSettings -SettingId $settings.ObjectId -SettingsValue $settings.GetSettingsValue() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment