%3CLINGO-SUB%20id%3D%22lingo-sub-1599167%22%20slang%3D%22en-US%22%3EHow%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1599167%22%20slang%3D%22en-US%22%3E%3CP%3EMicrosoft%20Teams%20usage%20has%20increased%20greatly%20during%20the%20current%20pandemic.%26nbsp%3B%20All%20types%20of%20organizations%20are%20using%20the%20communications%20tool%20to%20stay%20connected%20with%20its%20employees%20and%20customers%20alike.%26nbsp%3B%20The%20increase%20of%20use%20has%20also%20resulted%20in%20an%20increase%20of%20demand%20of%20system%20administrator's%20time%20to%20manage%20Microsoft%20Teams.%20Everything%20from%20adding%20users%20and%20groups%20to%20managing%20policies%20of%20said%20users%20and%20groups%20can%20be%20managed%20via%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fteams%2F%3Fview%3Dteams-ps%26amp%3BWT.mc_id%3Dmodinfra-8382-abartolo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EPowerShell%3C%2FA%3E.%26nbsp%3B%20This%20post%20will%20highlight%20the%20foundations%20to%20get%20started%20and%20provide%20links%20to%20continue%20your%20automation%20through%20script%20writing%20journey.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20begin%20...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%20id%3D%22toc-hId-1224702101%22%3EStep%201%3A%20Getting%20started%3CBR%20%2F%3E%26nbsp%3B%3C%2FH3%3E%0A%3COL%3E%0A%3CLI%3ELaunch%20PowerShell%20and%20run%20the%20following%20command%3CBR%20%2F%3E%3CPRE%3EInstall-Module%20-Name%20MicrosoftTeams%3C%2FPRE%3E%0A%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EWith%20the%20Microsoft%20Teams%20cmdlet%20installed%2C%20use%20the%20following%20to%20login%20into%20your%20Microsoft%20Teams%20tenant%3CBR%20%2F%3E%0A%3CPRE%3E%3CSPAN%3EConnect-MicrosoftTeams%3C%2FSPAN%3E%3C%2FPRE%3E%0A%3CSTRONG%3ENote%3A%3C%2FSTRONG%3E%20This%20will%20also%20work%20if%20multi-factor%20authentication%20is%20enabled%20and%20you%20will%20be%20asked%20for%20your%20Office%20365%20credentials%20to%20sign%20in%3CBR%20%2F%3E%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BUse%20the%20following%20command%20to%20see%20a%20list%20of%20available%20Microsoft%20Teams%20cmdlets%3CBR%20%2F%3E%0A%3CPRE%3EGet-TeamHelp%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%20id%3D%22toc-hId--582752362%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%20id%3D%22toc-hId-1904760471%22%3EStep%202%3A%20Choose%20your%20MS%20Teams%20cmdlet%20adventure%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20is%20a%20plethora%20of%20cmdlets%20available%20as%20listed%20by%20the%20previous%20step.%26nbsp%3B%20Here%20is%20a%20list%20of%20the%20cmdlets%20you%20will%20use%20most%20often%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CUL%3E%0A%3CLI%3ECreates%20a%20new%20Team%0A%3CPRE%3ENew-Team%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3ETeam%20properties%20management%0A%3CPRE%3ESet-Team%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3EErases%20a%20Team%0A%3CPRE%3ERemove-Team%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3ELists%20team%20objects%20with%20properties%3C%2FSPAN%3E%3CBR%20%2F%3E%0A%3CPRE%3EGet-Team%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3ECreates%20a%20new%20Team%0A%3CPRE%3ENew-Team%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3EAdds%20a%20user%20to%20a%20team%0A%3CPRE%3E%3CSTRONG%3EAdd-teamuser%3C%2FSTRONG%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3CLI%3ERemoves%20a%20user%20from%20a%20team%0A%3CPRE%3E%3CSTRONG%3ERemove-teamuser%3C%2FSTRONG%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0AThere%20is%20a%20great%20deal%20more%20as%20mentioned%20and%20all%20cmdlets%20can%20be%20found%20in%20the%20Microsoft%20Teams%20cmdlet%20reference%20document.%3C%2FUL%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%26nbsp%3B%3C%2FUL%3E%0A%3CH3%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%20id%3D%22toc-hId-97306008%22%3EStep%203%3A%20Managing%20Microsoft%20Teams%20policies%3C%2FH3%3E%0A%3CP%3E%3CSPAN%3EPolicies%20within%20Microsoft%20Teams%20govern%20over%20a%20user's%20or%20team's%20abilities%20within%20teams%20and%20channels.%20Policies%20can%20enforce%20on%20behalf%20of%20a%20single%20user%20or%20an%20entire%20organization.%26nbsp%3B%20The%20automation%20that%20PowerShell%20provides%20allow%20the%20Microsoft%20Teams%20administrator%20the%20ability%20to%20assign%26nbsp%3Bcustom%20policies%20to%20multiple%20users%20as%20required.%26nbsp%3B%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20this%20example%2C%20the%20following%20script%20assigns%20the%20Human%20Resources%20Management%20Policy%20to%20all%20users%20in%20the%20Human%20Resources%20group.%20The%20script%20begins%20by%20getting%20the%20GroupObjectId%20of%20the%20group.%26nbsp%3B%20Once%20acquired%2C%20it%20then%20finds%20the%20members%20of%20that%20group%20and%20assigns%20the%20policy%20to%20all%20users%20in%20the%20group.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%24group%20%3D%20Get-AzureADGroup%20-SearchString%20%22Human%20Resources%20group%22%0A%24members%20%3D%20Get-AzureADGroupMember%20-ObjectId%20%24group.ObjectId%20-All%20%24true%20%7C%20Where-Object%20%7B%24_.ObjectType%20-eq%20%22User%22%7D%24members%20%7C%20ForEach-Object%20%7B%20Grant-CsTeamsChannelsPolicy%20-PolicyName%20%22Human%20Resources%20Management%20Policy%22%20-Identity%20%24_.UserPrincipalName%7D%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20always%2C%20please%20share%20your%20comments%20below%20on%20bettering%20the%20above%20script%20or%20any%20questions%20you%20may%20have.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1599167%22%20slang%3D%22en-US%22%3E%3CP%3EMicrosoft%20Teams%20usage%20has%20increased%20greatly%20during%20the%20current%20pandemic.%26nbsp%3B%20All%20types%20of%20organizations%20are%20using%20the%20communications%20tool%20to%20stay%20connected%20with%20its%20employees%20and%20customers%20alike.%26nbsp%3B%20The%20increase%20of%20use%20has%20also%20resulted%20in%20an%20increase%20of%20demand%20of%20system%20administrator's%20time%20to%20manage%20Microsoft%20Teams.%20Everything%20from%20adding%20users%20and%20groups%20to%20managing%20policies%20of%20said%20users%20and%20groups%20can%20be%20managed%20via%20PowerShell.%26nbsp%3B%20This%20post%20will%20highlight%20the%20foundations%20to%20get%20started%20and%20provide%20links%20to%20continue%20your%20automation%20through%20script%20writing%20journey.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22How_to_Manage_Microsoft_Teams_via_PowerShell.png%22%20style%3D%22width%3A%20552px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F213322i2C9A170924BC24CB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22How_to_Manage_Microsoft_Teams_via_PowerShell.png%22%20alt%3D%22How_to_Manage_Microsoft_Teams_via_PowerShell.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1599167%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAnthony%20Bartolo%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1601722%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1601722%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20article.%20One%20thing%20I%20would%20recommend%20is%20not%20to%20do%20this%20in%20a%20large%20involvement.%20It%20takes%20a%20very%20long%20time%20to%20Iterate%20over%20each%20user%20and%20apply%20the%20policy.%20For%20anything%20with%2050-100%2B%20I%20would%20recommend%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fteams%2Fnew-csbatchpolicyassignmentoperation%3FWT.mc_id%3Dmodinfra-8382-abartolo%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Enew-csbatchpolicyassignment%3C%2FA%3E%20commandlet.%20Much%20faster.%20I%20was%20able%20to%20do%20700%20in%203%20min.%20The%20other%20way%20look%202%20hours%20and%20eventually%20timed%20out%20session.%3C%2FP%3E%0A%3CP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1601876%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1601876%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20point%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F735693%22%20target%3D%22_blank%22%3E%40timmybee%3C%2FA%3E.%26nbsp%3B%20Thank%20you%20for%20the%20share.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1602923%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1602923%22%20slang%3D%22en-US%22%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20term%20'Get-TeamHelp'%20is%20not%20recognized%20as%20the%20name%20of%20a%20cmdlet%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDo%20you%20know%20how%20to%20resolve%20this%20issue%3F%20I%20ran%20the%20first%20two%20commands%20smoothly.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1603019%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1603019%22%20slang%3D%22en-US%22%3E%3CP%3EI%20assume%20it%20was%20really%20meant%20to%20be%20'Get-Help%20Team'%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1604937%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604937%22%20slang%3D%22en-US%22%3E%3CP%3EGet-TeamHelp%20doesn't%20work!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1615939%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1615939%22%20slang%3D%22en-US%22%3E%3CP%3EWhy%20not%20just%20use%20%3CEM%3EGet-Command%20-Module%20MIcrosoftTeams%3C%2FEM%3E%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1604019%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1604019%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F766598%22%20target%3D%22_blank%22%3E%40geothing%3C%2FA%3E%26nbsp%3Band%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F766505%22%20target%3D%22_blank%22%3E%40QingchuanZhang%3C%2FA%3E%26nbsp%3Bwhat%20is%20listed%20there%20is%20correct%3A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Fteams%2FGet-TeamHelp%3Fview%3Dteams-ps%26amp%3BWT.mc_id%3Dmodinfra-8382-abartolo%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EGet-TeamHelp%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1673380%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1673380%22%20slang%3D%22en-US%22%3E%3CP%3EI%20tried%20running%20%3CEM%3EGet-TeamHelp%3C%2FEM%3E%20and%20it%20did%20not%20work%20for%20me%20either.%20Running%20%3CEM%3EGet-Command%20-Module%20MicrosoftTeams%3C%2FEM%3E%20as%20suggested%20by%20Jhochwald%20did%20not%20list%20%3CEM%3EGet-TeamHelp%3C%2FEM%3E%20as%20a%20valid%20command%2C%20but%20did%20show%20all%20of%20the%20valid%20MS%20Teams%20cmdlets.%20Also%20you%20could%20also%20do%20%3CEM%3EGet-Help%20*Team*%3C%2FEM%3E%20to%20pull%20a%20list%20of%20Teams%20cmdlets.%20Just%20be%20ready%20to%20sift%20through%20some%20NIC%20Teaming%20cmdlets.%20I%20have%20to%20concur%20with%20what%20everyone%20else%20is%20saying%20that%20%3CEM%3EGet-TeamHelp%3C%2FEM%3E%20is%20not%20a%20valid%20cmdlet.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1673768%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1673768%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F720242%22%20target%3D%22_blank%22%3E%40RichShivers%3C%2FA%3E%26nbsp%3Bat%20least%20the%20Version%201.1.6%20doesn't%20have%20the%26nbsp%3B%3CEM%3EGet-TeamHelp%3C%2FEM%3E%26nbsp%3B%3CSPAN%3Ecommand.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20also%20check%20the%20File%20list%20on%20the%20PowerShell%20Gallery.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1734031%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20Manage%20Microsoft%20Teams%20via%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1734031%22%20slang%3D%22en-US%22%3E%3CP%3EUseful%20article.%3C%2FP%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F102838%22%20target%3D%22_blank%22%3E%40Anthony%20Bartolo%3C%2FA%3E.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Microsoft

Microsoft Teams usage has increased greatly during the current pandemic.  All types of organizations are using the communications tool to stay connected with its employees and customers alike.  The increase of use has also resulted in an increase of demand of system administrator's time to manage Microsoft Teams. Everything from adding users and groups to managing policies of said users and groups can be managed via PowerShell.  This post will highlight the foundations to get started and provide links to continue your automation through script writing journey.

 

Let's begin ...

 

Step 1: Getting started
 

  1. Launch PowerShell and run the following command
    Install-Module -Name MicrosoftTeams
     
  2. With the Microsoft Teams cmdlet installed, use the following to login into your Microsoft Teams tenant
    Connect-MicrosoftTeams
    Note: This will also work if multi-factor authentication is enabled and you will be asked for your Office 365 credentials to sign in
     
  3.  Use the following command to see a list of available Microsoft Teams cmdlets
    Get-TeamHelp

 

Step 2: Choose your MS Teams cmdlet adventure

 

There is a plethora of cmdlets available as listed by the previous step.  Here is a list of the cmdlets you will use most often:

 

    • Creates a new Team
      New-Team
    • Team properties management
      Set-Team
    • Erases a Team
      Remove-Team
    • Lists team objects with properties
      Get-Team
    • Creates a new Team
      New-Team
    • Adds a user to a team
      Add-teamuser
    • Removes a user from a team
      Remove-teamuser
    • There is a great deal more as mentioned and all cmdlets can be found in the Microsoft Teams cmdlet reference document.

 

     

Step 3: Managing Microsoft Teams policies

Policies within Microsoft Teams govern over a user's or team's abilities within teams and channels. Policies can enforce on behalf of a single user or an entire organization.  The automation that PowerShell provides allow the Microsoft Teams administrator the ability to assign custom policies to multiple users as required.  

 

In this example, the following script assigns the Human Resources Management Policy to all users in the Human Resources group. The script begins by getting the GroupObjectId of the group.  Once acquired, it then finds the members of that group and assigns the policy to all users in the group.

 

$group = Get-AzureADGroup -SearchString "Human Resources group"
$members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true | Where-Object {$_.ObjectType -eq "User"}$members | ForEach-Object { Grant-CsTeamsChannelsPolicy -PolicyName "Human Resources Management Policy" -Identity $_.UserPrincipalName}

 

As always, please share your comments below on bettering the above script or any questions you may have.

9 Comments
Visitor

Great article. One thing I would recommend is not to do this in a large involvement. It takes a very long time to Iterate over each user and apply the policy. For anything with 50-100+ I would recommend the new-csbatchpolicyassignment commandlet. Much faster. I was able to do 700 in 3 min. The other way look 2 hours and eventually timed out session.



Microsoft

 

The term 'Get-TeamHelp' is not recognized as the name of a cmdlet

 

 

Do you know how to resolve this issue? I ran the first two commands smoothly.

Occasional Visitor

I assume it was really meant to be 'Get-Help Team'

Microsoft

@geothing and @QingchuanZhang what is listed there is correct: Get-TeamHelp

Get-TeamHelp doesn't work!

Senior Member

Why not just use Get-Command -Module MIcrosoftTeams ?

Senior Member

I tried running Get-TeamHelp and it did not work for me either. Running Get-Command -Module MicrosoftTeams as suggested by Jhochwald did not list Get-TeamHelp as a valid command, but did show all of the valid MS Teams cmdlets. Also you could also do Get-Help *Team* to pull a list of Teams cmdlets. Just be ready to sift through some NIC Teaming cmdlets. I have to concur with what everyone else is saying that Get-TeamHelp is not a valid cmdlet.

Senior Member

@RichShivers at least the Version 1.1.6 doesn't have the Get-TeamHelp command.

I also check the File list on the PowerShell Gallery.

Senior Member

Useful article.

Thanks @Anthony Bartolo.