Share via


O365 Groups tidbit - Using PowerShell to manage groups

Hello All,

I have written before about groups and how they function in Office 365, so I thought now I would touch on how we can manage them and more specifically how we can manage them with PowerShell.

First of all to use PowerShell to manage O365 Groups you need to make sure you have the correct modules, and the modules you want are:

  1. Azure Active Directory to download and install follow these steps, for a list of all cmdlets see this article.
  2. Exchange online to download and install follow these steps.

Once you install the modules and you have connected to O365 Services (See this article on how to connect to all services) for Azure AD and Exchange, you can now run thru these management commands:

Get-UnifiedGroup Use this cmdlet to look up existing Office 365 Groups, and to view properties of the group object
Set-UnifiedGroup Update the properties of a specific Office 365 Group
New-UnifiedGroup Create a new Office 365 group. This cmdlet provides a minimal set of parameters, for setting values for extended properties use Set-UnifiedGroup after creating the new group
Remove-UnifiedGroup Delete an existing Office 365 Group
Get-UnifiedGroupLinks Retrieve membership and owner information for an Office 365 Group
Add-UnifiedGroupLinks Add hundred or thousands of users, or new owners, to an existing Office 365 Group
Remove-UnifiedGroupLinks Remove owners and members from an existing Office 365 Group
Get-UserPhoto Used to view information about the user photo associated with an account. User photos are stored in Active Directory
Set-UserPhoto Used to associate a user photo with an account. User photos are stored in Active Directory
Remove-UserPhoto Remove the photo for an Office 365 group

 

Some things you can or must do via PowerShell when managing your O365 Groups

  1. Create settings at the directory level that will apply to all O365 Groups

$GuidelineUrl = “https://weaverinc.sharepoint.com/sites/guidelines

$TemplateID = Get-AzureADDirectorySettingTemplate | where $_.DisplayName -eq “Group.Unified”

$Template = Get-AzureADDirectorySettingTemplate -Id $TemplateID

$Setting = $template.CreateDirectorySetting()

$setting["UsageGuidelinesUrl"] = $GuidelineUrl

New-AzureADDirectorySetting -DirectorySetting $setting

FYI For settings other then ‘UsageGuidelinesUrl’ check out this article

  1. Hiding an O365 Group from the GAL, who knows I’m sure you can think of a good reason to do this :)

Set-UnifiedGroup -Identity "IT Department" -HiddenFromAddressListsEnabled $true

  1. Setting mailtips and there translations

Set-UnifiedGroup -Identity "IT Group" -MailTip "The group that makes IT work for you" -MailTipTranslations "@{Add="ES: El grupo que hace que funcione para usted "

Pax