SharePoint frequently reuses terms, which often makes conversations and forum posts a lot of fun. Thereâ€
s at least three “Groups†in Office 365:
Office 365 Groups are a combination of an Exchange email account with the groupâ€
s name that is used to store conversations, and a “OneDrive – like†site collection to store files.
A collection of Office 365 Groups facts:
s OneDrive.
s no limit for number of Groups per tenant.
s owner is deleted.
s not considered to be a personal OneDrive. There is no “user†for the Group OneDrive. The mailbox can store up to 50GB of messages, posts and calendar entries. The SharePoint Site Collection has a max of 1TB.
s not customizable.
t check out/in. (I saw this listed as a feature, but itâ€
s not in my tenants.)
s no Site Permissions page or 2nd tier recycle bin.
t recover files deleted by members.
t find a place to change Public/Private status after the group has been created.
)| Groups | Team Sites | |
| Can add lists/libraries | No | Yes |
| Can add pages | No | Yes |
| Can add columns/metadata | No | Yes |
| Can use Content Types | No | Yes |
| Can hide membership | No | Yes |
| Can brand | No | Yes |
| Can be fully managed with PowerShell | No | Yes |
So since this feature is enabled by default. Users in your organization may have already started creating groups and hidden SharePoint site.
So first we need to disable this option right away.
Now need to check your company-wide configuration settings through the Get-MsolCompanyInfo Windows PowerShell cmdlet. This cmdlet will display your current company-wide configuration settings that affect all users. You specifically need to verify that the UserPermissionToCreateGroupsEnabled parameter is set to False.
To check your Company-level configuration settings
You will first need to connect to your Office 365 service. In the Windows Azure Active Directory Module for Windows PowerShell, type and enter the following:
Connect-MsolService
In the Sign in to your Account screen, enter your credentials to connect you to your service, and click Sign in.

You will be returned to a prompt in the Windows Azure Active Directory Module.
You will need to display your company-wide configuration settings. To do this, type and enter:
Get-MsolCompanyInformation
This will display a listing of the current configuration settings that apply to all users in your company.

As you can see the value for the UsersPermissiontoCreateGroupsEnabled setting is True. We need to change this to False.
To change the UsersPermissionToCreateGroupsEnabled setting value
You will first need to use the Set-MsolCompanySettings cmdlet to change the UsersPermissionToCreateGroupsEnabled parameter to False. In the Windows Azure Active Directory Module for Windows PowerShell, type and enter the following:
Set-MsolCompanySettings - UsersPermissionToCreateGroupsEnabled $False
You will be returned to a prompt in the Windows Azure Active Directory Module.
After changing the setting, you then need to run the Get-MsolCompanyInfo cmdlet to verify that the value has changed to True.
Get-MsolCompanyInfo
After running the cmdlet, check the displayed information to verify that the UsersPermissionToCreateGroupsEnabled setting value has changed to False.
#Connecting to SharePoint #User account with Global Admin Permissions $adminUPN="[email protected]" #Organization Name (myorganizationinc.onmicrosoft.com) $orgName="myorganizationinc" #Prompting and using the password $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password." #Making the Connection Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
Get a list of Site Collections
Get-SPOSite -Detailed | Format-Table -AutoSize
More than likely the Group SharePoint Site is restricted to the user that may have created it. You may get this error when trying to remove it:

To remove it you need to take ownership as the CollectionOwner
Set-SPOUser -Site http://myorganizationinc.sharepoint.com/sites/<YourGroupsSite> -LoginName [email protected] -IsSiteCollectionOwner $true
Now if you want to do this for all the site collections:
$Sites = Get-SPOSite
ForEach ($Site in $Sites)
{
Set-SPOUser -Site $site -LoginName [email protected] -IsSiteCollectionOwner $true
}
Once this is applied the admin will be able to remove the hidden Sharepoint collection. Remove the site collections that are no longer needed.
Remove-SPOSite -Identity https://myorganizationinc.sharepoint.com/sites/<YourGroupsSite> -NoWait
Now to delete the groups that the users created. Head over to the Office365 Admin Portal.
Click the “Office 365 group” from the selection to show all groups (These should be all cloud based)

Once the groups are displayed remove them as necessary.
Groups are no longer in your environment.
If you are in Hybrid mode you cannot user Groups in a clean fashion. It will get messy. Sooner or later you will need to plan for migration of your distribution groups to Groups. Know your current limitations and hold.
Migrate distribution lists to Office 365 Groups – Admin help
The following table lists which distribution lists are eligible or not eligible for migration
| Property | Eligibility |
| On-premise managed distribution list. | Not eligible |
| Nested distribution lists. Distribution list either has child groups or is a member of another group. | Not eligible |
| Moderated distribution list | Not eligible |
| Distribution lists with send on behalf settings | Not eligible |
| Distribution lists hidden from address lists | Not eligible |
| Distribution lists with member RecipientTypeDetails other than UserMailbox, SharedMailbox, TeamMailbox, MailUser | Not eligible |
| Distribution lists with member join or depart restriction as Closed | Eligible. Converted to a private Office 365 Group. |
| Distribution lists with custom delivery status notifications. ReportToManager = true, ReportToOriginator = false ReportToManager = false, ReportToOriginator = false | Eligible. Office 365 groups don’t understand these properties, and delivery status notifications are always sent to the person that sent the email. |
Create a Batch file or Powershell script and add it to scheduled task.
[su_tooltip position=”north” content=”Hereâ€
s what all of those funky switches do. The first two arguments are for the InstallShield application, setup.exe. /S requests a silent installer, and /v lets the application know that youâ€
re going to pass switches directly to the MSI. This is why the command structure after the /v is enclosed in double quotes. The /qn portion is MSI-speak for no user interface, while the REBOOT=R portion is toReallySupress the reboot. ADDLOCAL is describing what features to install locally, while REMOVE states to toss out the HGFS (Shared Folders) feature. This way ensures that new features will be added without having to call them all out in a list.”]Please check permissions on the files and folders. If you have unique or specialized permission on the file or folders these wont work.[/su_tooltip]
@echo off :: set folder path set dump_path=c:\shares\dump :: set min age of files and folders to delete set max_days=7 :: remove files from %dump_path% forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd /c del /q @path" :: remove sub directories from %dump_path% forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"
# set folder path
$dump_path = "C:\shares\dump"
# set min age of files
$max_days = "-7"
# get the current date
$curr_date = Get-Date
# determine how far back we go based on current date
$del_date = $curr_date.AddDays($max_days)
# delete the files
Get-ChildItem $dump_path -Recurse | Where-Object { $_.LastWriteTime -lt $del_date } | Remove-Item
]]>