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

Leave a Reply

  Posts

1 2 3 4 5
January 16th, 2017

Join my sessions at NIC – Nordic Infrastructure Conference 2-3. feb.

Regardless of how many presentations I’ve had, there are always a line of questions to be answered when the session is over. One of my sessions are for you: Ask me anything!

January 1st, 2017

Congratulations 2017 Microsoft MVP!

For the fourth year, I’m truly honored to recieve the highest recognized award for ITpros.

December 18th, 2016

Resolving Modern Device Issues for SMBs

For many SMBs, modern device management have proven to give some challenges, as the devices just like other areas of the tech industry have been moving forwards

August 14th, 2016

Meet Ståle, Johan, John and myself and our take as MVP’s

Closing our series on Microsoft Most Valuable Professionals we’ve put together four more videos of some of the best IT […]

May 22nd, 2016

Device management and troubleshooting DIY-style

In a changing IT landscape where we move from managed devices to more or less unmanaged dittos the need for self-healing systems and smart shortcuts are ever increasing.

May 22nd, 2016

Meet Andy, Wally and Marius and their take as MVP’s

Becoming and being a MVP is like nothing I’ve ever imagined. So why take my word for it?

February 17th, 2016

Surface Book released in major european markets

It’s a little more than four months since the Windows 10 device launch event in NYC witch revealed the Surface Book. By the 18th of february the populear device is shipped in several major european countries.

February 5th, 2016

Guide: Windows Hello with two accounts

Any ITpro in the industry is used to a high number of user accounts, either it is admin- user, limited rights or ad-hoc user accounts.

February 5th, 2016

Download slide deck: Surface Pro&Book explained

For those of you who enjoyed our session Surface Pro&Book explained, or for some reason could not join the session […]

February 4th, 2016

A guide for Surface Data Eraser

Either it’s Repair, repurpose or decomission – secure wipe of your device should allways be a part of your device management lifecycle