How to Create MS TEAMS for all Existing Office 365 Groups via PowerShell in One go.

%3CLINGO-SUB%20id%3D%22lingo-sub-477787%22%20slang%3D%22en-US%22%3EHow%20to%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20via%20PowerShell%20in%20One%20go.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-477787%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Everyone.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreetings!!!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20like%20to%20share%20some%20insights%20on%20How%20to%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20via%20PowerShell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAs%20we%20know%20that%20creating%20Teams%20from%20Office%20365%20Groups%20is%20very%20easy%20task%20but%20if%20we%20have%20to%20create%20multiple%20Teams%20using%20GUI%20is%20very%20complex%20and%20Time%20consuming.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20I%20made%20a%20script%20in%20which%20we%20can%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20in%20One%20Go.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20perform%20the%20following%20action%20plan%20to%20achieve%20this.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E(%3CSTRONG%3ENote%3C%2FSTRONG%3E%3A%20If%20the%20Team%20is%20already%20created%20for%20the%20same%20Office%20365%20Group%20then%20we%20will%20get%20an%20error%20or%20warning%20for%20the%20same.)%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EStep%201%3A%20Connect%20to%20Exchange%20PowerShell.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERun%20the%20following%20commands%20to%20Connect%20with%20Exchange%20PowerShell%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Set-ExecutionPolicy%20Unrestricted%3CBR%20%2F%3E2.%20%24UserCredential%20%3D%20Get-Credential%3CBR%20%2F%3E3.%20%24Session%20%3D%20New-PSSession%20-ConfigurationName%20Microsoft.Exchange%20-ConnectionUri%20%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%2F%3C%2FA%3E%20-Credential%20%24UserCredential%20-Authentication%20Basic%20-AllowRedirection%3CBR%20%2F%3E4.%20Import-PSSession%20%24Session%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EStep%202%3A%20Connect%20to%20MS%20TEAMS%20PowerShell%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Install-Module%20-Name%20MicrosoftTeams%3CBR%20%2F%3E2.%20Connect-MicrosoftTeams%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EStep%203%3A%20Run%20the%20Following%20command%20to%20ignore%20the%20Error%20messages%20or%20Warnings%20from%20the%20PS%20session.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20%24ErrorActionPreference%20%3D%20'SilentlyContinue'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20Run%20the%20following%20commands%20to%20Create%20Teams%20from%20Existing%20Office%20365%20Groups.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%E2%80%A2%20Get-UnifiedGroup%20%7C%20%25%20%7BNew-Team%20-group%20%24_.ExternalDirectoryObjectId%7D%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20will%20get%20the%20output%20for%20the%20Groups%20with%20GroupIDs%20(e.g.%2011ed4b69-66b9-4571-8ccc-82fc3d%23%23%23%23%23%23)%20for%20which%20MS%20TEAMS%20has%20been%20created.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20check%20Group%20Details%20using%20the%20%3CSTRONG%3EGroupID%3C%2FSTRONG%3E%20by%20running%20the%20following%20command%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E2%80%A2%20%3CSTRONG%3EGet-UnifiedGroup%2011ed4b69-66b9-4571-8ccc-82fc3d%23%23%23%23%23%23%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20order%20to%20cross%20verify%2C%20you%20can%20navigate%20to%20MS%20TEAMS%20client%2FWeb%20client%20and%20check%20that%20Teams%20there%2C%20If%20you%20are%20the%20part%20of%20that%20Office%20365%20Group.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%3CSTRONG%3EIf%20you%20want%20to%20create%20a%20Team%20for%20Particular%20Group%20then%20please%20refer%20the%20action%20plan%20mentioned%20below%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%26nbsp%3B%3C%2FP%3E%3CUL%3E%3CLI%3E%3CSTRONG%3E%26nbsp%3B(Get-UnifiedGroup).ExternalDirectoryObjectId%3C%2FSTRONG%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3EYou%20will%20get%20GroupId's%20for%20all%20Office%20365%20group%20and%20then%20you%20can%20Run%20the%20Following%20command%20to%20Create%20a%20Team%20for%20that%20Group%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3EFor%20e.g.%3C%2FP%3E%3CP%20class%3D%22%22%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ENew-Team%20-Group%20f1acde4f-6d3b-42f8-b738-29556c%23%23%23%23%23%23%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%3CSTRONG%3E(%3C%2FSTRONG%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3CSPAN%3E%3A%20If%20the%20Team%20is%20already%20created%20for%20the%20same%20Office%20365%20Group%20then%20we%20will%20get%20an%20error%20or%20warning%20for%20the%20same.%3CSTRONG%3E)%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20compile%20a%20script%20which%20will%20differentiate%20between%20the%20Groups%20for%20which%20Team%20has%20been%20created%20and%20the%20Groups%20for%20which%20it%20is%20not.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20let%20me%20know%20if%20you%20have%20any%20queries%20on%20this.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20ignore%20if%20you%20already%20aware%20about%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%2C%3C%2FP%3E%3CP%3EShrikant%20Suravase%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-515399%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20via%20PowerShell%20in%20One%20go.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-515399%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F132149%22%20target%3D%22_blank%22%3E%40Shrikant%20Suravase%3C%2FA%3E%26nbsp%3BHello!%20While%20we%20appreciate%20your%20contribution%2C%20you%20posted%20this%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FAzure-Data-Explorer%2Fbd-p%2FKusto%22%20target%3D%22_self%22%3EAzure%20Data%20Explorer%20space%3C%2FA%3E%20and%20I%20don't%20believe%20anything%20you%20posted%20has%20to%20do%20with%20that%20product.%20I've%20moved%20this%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FMicrosoft-Teams%2Fbd-p%2FMicrosoftTeams%22%20target%3D%22_self%22%3EMicrosoft%20Teams%20space%3C%2FA%3E%20for%20better%20visibility%20-%20please%20check%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FCommunities%2Fct-p%2Fcommunities%22%20target%3D%22_self%22%3ECommunities%3C%2FA%3E%20for%20the%20appropriate%20place%20to%20post%2C%20based%20on%20the%20topic%20you%20are%20posting%20about%2C%20for%20future%20posts.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1675672%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20via%20PowerShell%20in%20One%20go.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1675672%22%20slang%3D%22en-US%22%3E%3CP%3EBro%2C%20you%20re%20a%20life%20saver%2C%20thanks%20!!!%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F132149%22%20target%3D%22_blank%22%3E%40Shrikant%20Suravase%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1799188%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Create%20MS%20TEAMS%20for%20all%20Existing%20Office%20365%20Groups%20via%20PowerShell%20in%20One%20go.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1799188%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F132149%22%20target%3D%22_blank%22%3E%40Shrikant%20Suravase%3C%2FA%3E%26nbsp%3BIt%20only%20worked%20for%20the%20creation%20of%20one%20Team.%20All%20the%20other%20Office365-groups%20were%20ignored%20without%20warning.%20Any%20suggestions%3F%3CBR%20%2F%3EBig%20thanks%20for%20the%20try!%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

Hello Everyone.

 

Greetings!!!!

 

I would like to share some insights on How to Create MS TEAMS for all Existing Office 365 Groups via PowerShell.

 

As we know that creating Teams from Office 365 Groups is very easy task but if we have to create multiple Teams using GUI is very complex and Time consuming.

 

So I made a script in which we can Create MS TEAMS for all Existing Office 365 Groups in One Go.

 

Please perform the following action plan to achieve this.

 

(Note: If the Team is already created for the same Office 365 Group then we will get an error or warning for the same.)

 

Step 1: Connect to Exchange PowerShell.

 

Run the following commands to Connect with Exchange PowerShell:

 

1. Set-ExecutionPolicy Unrestricted
2. $UserCredential = Get-Credential
3. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
4. Import-PSSession $Session

 

Step 2: Connect to MS TEAMS PowerShell:

 

1. Install-Module -Name MicrosoftTeams
2. Connect-MicrosoftTeams

 

Step 3: Run the Following command to ignore the Error messages or Warnings from the PS session.

 

1. $ErrorActionPreference = 'SilentlyContinue'

 

Now, Run the following commands to Create Teams from Existing Office 365 Groups.

 

• Get-UnifiedGroup | % {New-Team -group $_.ExternalDirectoryObjectId}

 

You will get the output for the Groups with GroupIDs (e.g. 11ed4b69-66b9-4571-8ccc-82fc3d######) for which MS TEAMS has been created.

 

You can check Group Details using the GroupID by running the following command:

 

Get-UnifiedGroup 11ed4b69-66b9-4571-8ccc-82fc3d######

 

In order to cross verify, you can navigate to MS TEAMS client/Web client and check that Teams there, If you are the part of that Office 365 Group.

 

If you want to create a Team for Particular Group then please refer the action plan mentioned below:

 

  •  (Get-UnifiedGroup).ExternalDirectoryObjectId

 

You will get GroupId's for all Office 365 group and then you can Run the Following command to Create a Team for that Group:

 

For e.g.

 

New-Team -Group f1acde4f-6d3b-42f8-b738-29556c######

 

(Note: If the Team is already created for the same Office 365 Group then we will get an error or warning for the same.)

 

I am trying to compile a script which will differentiate between the Groups for which Team has been created and the Groups for which it is not.

 

Please let me know if you have any queries on this. 

 

Please ignore if you already aware about it.

 

Regards,

Shrikant Suravase

 

3 Replies
Highlighted

@Shrikant Suravase Hello! While we appreciate your contribution, you posted this in the Azure Data Explorer space and I don't believe anything you posted has to do with that product. I've moved this to the Microsoft Teams space for better visibility - please check Communities for the appropriate place to post, based on the topic you are posting about, for future posts. 

Highlighted
Highlighted

@Shrikant Suravase It only worked for the creation of one Team. All the other Office365-groups were ignored without warning. Any suggestions?
Big thanks for the try!