One of my clients asked me to write a script to change the name, primary SMTP address and description of Office 365 Groups. I remembered that Wictor Wilen wrote a blog series about this subject.
To meet my client’s needs, I need to use the Set-UnifiedGroup PowerShell cmdlet to change those Office 365 Groups properties. I’ll use the script Wictor uses to connect to Exchange Online, which you can see in figure 1. I have modified Wictor’s script (highlighted in the box) so it can process an XML file with a batch of groups in there. In line 10, I import the XML file and then I will declare a variable in the right node in our XML.
Figure 1: Import the XML and declare the $Groups variable.
Next, I added a foreach loop that uses the XML file to loop through all the groups in that XML file (see figure 2). We need to do some error handling, so that is why I also added a try-catch-finally block in the foreach loop. So, in Wictor’s original script, I replace line 18 with the following block of code to do this.
Figure 2: The foreach loop with the Set-UnifiedGroup cmdlet.
I only use the Identity, DisplayName, MailTip and PrimarySmtpAddress parameters in this script, but you can add other parameters if you want. To see all the files I made during this blogpost, check out my GitHub repository.
Last but not least: thanks to Wictor for the great posts about Office 365 Groups!
You can view Daniel's original blog here: http://www.o365dude.nl/2015/11/09/edit-office-365-groups-with-powershell/