Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

Disable Office 365 Groups Creation: Redux

$
0
0

Several months ago, I wrote a blog on Disabling Office 365 Groups.  It seems as though we couldn’t leave well enough alone.  Such is a price of progress.

I got a new laptop a few weeks ago, and then found myself in the position of helping out a few colleagues this week.  One of the tasks for this particular customer was disabling Office 365 Groups.

No sweat. I’ve done this before. I even blogged about it.

I pulled up my blog page referencing the steps.

Pro tip: start a blog so you can have publicly searchable content that has all the steps you used to do  something. Also, it makes you seem smart.

At any rate, I start the process, and go to download the Azure Preview module like my post recommends, only to find that we’ve changed that part, too.  I’m now at the customer with a new laptop and I don’t have access to the tools to complete the job.  So, what do I do?

just fuggedaboutit

No, I blog about it.

Without further ado, here’s the cheat sheet for the new cmdlets, where to download the module, and how to be a rockstar.

  1. If you don’t have Windows 10, go to the PowerShellGallery and download PowerShellGet.
  2. Launch an elevated Windows PowerShell console.
  3. Get the Azure Active Directory V2 Preview module (details are available here about it, but guess what–there’s nothing to download there) by running this:
    Install-Module -Name AzureADPreview
  4. Then, replace the original *msolsetting* with *AzureADSetting* cmdlets (oh, and connect to MSOL, Azure, and Exchange Online PowerShell sessions to complete the tasks).

The following script will:

  • Connect to Microsoft Online Service
  • Connect to the Azure AD endpoint
  • Connect to Exchange Online
  • Specify Global Admins as the group that can create Unified Groups (Office 365 Groups)
  • Disable the Groups Creation in OWA
Import-Module MSOnline
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
Connect-AzureAD -Credential $UserCredential
Connect-MsolService -Credential $UserCredential
$GlobalAdmins = Get-MsolRole -RoleName "Company Administrator"
$GlobalAdminsObjectID = $GlobalAdmins.ObjectId.ToString()
$template = Get-AzureADDirectorySettingTemplate | where-object {$_.DisplayName -eq "Group.Unified"}
$setting = $template.CreateDirectorySettings()
$setting["EnableGroupCreation"] = "false"
$setting["GroupCreationAllowedGroupId"] = $GlobalAdminsObjectID
New-AzureADDirectorySetting -DirectorySetting $setting
Get-OwaMailboxPolicy | ? { $_.IsDefault -eq $true } | Set-OwaMailboxPolicy -GroupCreationEnabled $false

If you’ve already created a directory setting and you want to update it, you can use:

Get-AzureADDirectorySetting | Set-AzureADDirectorySetting -DirectorySetting $setting

Until it changes next time.


Viewing all articles
Browse latest Browse all 36188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>