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;

  • Alex

  Posts

1 2 3 7
February 29th, 2020

My slides from Microsoft Ignite The Tour: The grand tour of data protection with Microsoft 365

As promised during the event in Copenhagen, I’m sharing both my slides and my demonstration videos from my breakout session […]

February 28th, 2020

My slides from Microsoft Ignite The Tour: Do and don’t – on-boarding and end-user adoption of Microsoft 365

Thank you all for attending my session on Do and don’t – on-boarding and end-user adoption of Microsoft 365. As […]

February 13th, 2020

My slides from NIC 2020: Malware protection on Windows 10 using Hyper-V and OneDrive for Business

Thank you all for joining my session at the Nordic Infrastructure Conference (NIC) in Oslo. As promised (and always), here […]

November 8th, 2019

My slides from THR2037 – Microsoft Ignite 2019

It’s Friday and last day of Microsoft Ignite 2019 – still – a stronghold of geeks attended my last theater […]

November 8th, 2019

My slides from THR3032 – Microsoft Ignite 2019

First of all – a big thank you to all who attended my session on Thursday. As promised, I’m uploading […]

August 21st, 2019

Blocking specific hardware manufacturers from corporate resources

Microsofts Senior Program Manager, Matt Shadbolt, recently confirmed that the company is working to more granular separate what devices and […]

August 2nd, 2019

Updates to AAD and O365 Naming policy

Although it’s been available through PowerShell for quite some time, the option for adding and editing naming policies in Azure AD

May 22nd, 2019

Get my slides from VeeamON Miami

Thank you all!

March 14th, 2019

Get my slides from ExpertsLive Cafe Bergen

It’s amazing to see how many attended the local ExpertsLive Café event in Bergen the 14th of march 2019. As […]

January 1st, 2019

Congratulations 2019 Windows Insider MVP!

In addition to my fifth year as a Microsoft MVP, I’m truly honored to receive the award for Windows Insider […]