List

Needless to say, creative naming of Groups and Team sites is a never-ending story. This guide, however, let you retrofit the name of those badly named groups.

Now, in order to perform these actions, there are some prerequisites where AzureADPreview and Teams (if you are to retrofit a Teams group) for PowerShell. These packages are installed with the following commands:

Install-Module -Name AzureADPreview
Install-Module -Name MicrosoftTeams

Connecting and retrofritting

In order to identify the groups that you desire to rename, you could type in the groups name, or E-mail. I prefer the latter for better control.
$UNIQ = Read-Host "Please type the group name/E-mail that you desire to change"

The following code will prompt you as a tenant admin to type in the new name for the group, and the domain for your alias

$NewName = Read-Host "Please type the desired name of the group"
$DomainName = Read-Host "Please type your domain, eg. solaat.no"

In order to clean up clutter (removal of invalid characters in the groups new E-mail), the following command create the new mail alias.

$NM = $NewPrefix + ($NewName -replace " ","" -replace '[^a-zA-Z0-9]', '')

In order to retrofit the group, the code below needs to be altered in line 2 for personalization of the note. The two last lines provides a visual outcome of the change that will happen.

$OldGroupDN = (Get-UnifiedGroup -Identity $UNIQ).DisplayName
$NewNote = (Get-UnifiedGroup -Identity "$UNIQ").Notes + "`n`n - New name by solaat.no"
$NewMail = ("smtp:" + $NM + $DomainName)
$MailPool = (Get-UnifiedGroup -Identity $UNIQ).EmailAddresses + $NewMail
Write-Host "`t" $OldGroupDN "updated to" $NewName
Write-Host "`t" (Get-UnifiedGroup -Identity $UNIQ).EmailAddresses + "updated to" $NewMail

The changes will be committed to the tenant by executing the following commandline;
Set-UnifiedGroup -Identity $OldGroupDN -Alias $NM -DisplayName $NewName -Notes $NewNote -PrimarySmtpAddress ($NM + $DomainName)

Changes done to your group/teams should now be visible in your tenant – or by running the following command;
(Get-UnifiedGroup -Identity $NewName).EmailAddresses

As you may notice, the old E-mail alias is kept, while the new is set as primary SMTP, this ensures that any data or shared notes are still accessible from the old sharing and no new URLs are needed. Hence the outcome in PowerShell should look something like this;

Retrofitting

  • Alex

  Posts

1 2 3 5
March 27th, 2018

Guide: Retrofit your Office 365 groups- and Teams name

Needless to say, creative naming of Groups and Team sites is a never-ending story. This guide, however, let you retrofit the name of those badly named groups

February 4th, 2018

Get my slides from NIC Future Edition 2018

Like always, NIC is one of the most awesome conferences with speakers from the entire world and a technical level […]

January 4th, 2018

Congratulations – Microsoft OneDrive Expert (MODE) member

Congratulations and welcome as a charter member to the Microsoft OneDrive Expert (MODE) program. You have been identified as one of the top IT pro influencers in the world due to your knowledge and impact on the IT pro community around Microsoft technologies.

November 24th, 2017

Get AirServer for Xbox One (Black Friday discount)

Turn your Xbox One into a Apple TV

October 25th, 2017

Get our slides from TechDays 2017

First of all, I would like to thank you each and every one of awesome people for joining Olav and mine sessions at TechDays 25th of October in Stockholm

September 1st, 2017

CB or CBB for your clients?

Patch management is more important than ever and sometimes you might end up with questions like “what is the difference between CB and CBB – and how many days should I defer?”

August 10th, 2017

Say hello to the new PowerShell Module Browser

Ever since I started scripting and programming, features like “Get-Help” and javadoc have been my lifesaver – now I welcome a new tool: PowerShell Module Browser

July 12th, 2017

Meet me at TechDays Stockholm

I am honored to be invited to TechDays as a speaker for the third time. For those of you who […]

February 3rd, 2017

Get my slides from NIC 2017

For those who could, and those who couldn’t join my sessions – here are my slides

January 27th, 2017

Use PowerShell to generate driver- and batteryreport

Every now and then I get these questions regarding power management, sluggish performance in general. As a cheat-sheet, I’ve come up with this PowerShell script that gives you all you need in one run