Forum Discussion
Creating classes using powershell 2020
Hi Gab7 ,
Off the top of my head I am wondering if the way to go would be to facilitate the desired domain specification by way of creating an M365 Group, along the lines of https://answers.microsoft.com/en-us/msoffice/forum/msoffice_o365admin-mso_domains/create-an-office-365-group-in-different-domain/6272ad0b-8cb9-45ca-a96f-888a1b49f2e3
And then once that is present and correct just Teams enable that Group.
I am not sure it will solve your issue but worth knowing about anyway, I would also take a look at:
https://pnp.github.io/cli-microsoft365/cmd/teams/team/team-add/
I believe from an end user perspective, if they were creating Teams you would handle this by way of an Exchange Address Policy, so in theory, albeit excessive. You could look to have different accounts, with different EAPs applied based on which domain you want to create the Team in.
Thanks
Henry
- Gab7Sep 02, 2020Copper Contributor
Thanks for your help, the thing is that I absolutely need the classroom template to create proper teams, but your first post gave me a great idea, it's a bit complex just to create a class but it might work.
I'm going to try to create the teams like I usually do but with a slight difference like I said :
"so I have to put something like : class20B to make it work"
and then i'll use the :
Set-UnifiedGroup -Identity "class20B@domain1.fr" -PrimarySmtpAddress "mailto:class20@domain1.fr
to change the address so I won't have to manually change the adresses in the administration web page.
I wonder if it will make an error, I'll keep this post updated.
Thanks again.
Gabriel
- HenryPhillipsNimbitechSep 02, 2020Bronze ContributorAlso you may need to do a start-sleep in there after creation for x amount of seconds to allow for the group to be fully instantiated before moving on
- Gab7Sep 07, 2020Copper Contributor
It worked !!
I now create my classes using the teams module but with a slight difference (like I said before) and when all teams are created, I use the given GroupID and the following command (with the exchange online module this time) :
Set-UnifiedGroup -Identity $GroupID -PrimarySmtpAddress $MailAfter
And it changes the primary address 🙂
thx for your help
- HenryPhillipsNimbitechSep 02, 2020Bronze ContributorHi,
I think that will absolutely work. If the Exchange module doesn't play the SharePoint PnP Online module can do something similar but for permissions you may have to do something along the lines of connect-pnponline -scopes groups.readwrite.all or something to that effect.
Thanks
Henry