📙 Tutorial: How to create and manage Microsoft Teams via PowerShell?
The Microsoft Teams PowerShell-module provides the ability to run scripts or modify policies through the command line interface of the Administrator panel.
Sometimes this is a practical way to quickly make changes all at once or adjust settings not yet available in the graphical interface or through the Teams control panel https://admin.teams.microsoft.com. These bulk changes can be useful if you want to quickly modify large numbers of settings or access settings that are not yet fully available in the graphical interface.
What is PowerShell?
PowerShell is a command-line interpreter and environment developed by Microsoft for configuring and managing systems. It is based on the .NET Framework and provides a comprehensive set of cmdlets (command-line tools) for performing a wide variety of tasks, such as managing user accounts, installing software, and managing network configurations. PowerShell is part of several Microsoft products, including Windows and Office 365, and can be used by system administrators and other advanced users.
Open Powershell as administrator
Install Microsoft's PowerShell module Teams
Run the following line in PowerShell:
Install-Module MicrosoftTeams
Connecting to PowerShell
Import-Module MicrosoftTeams Set-ExecutionPolicy -ExecutionPolicy Unrestricted Connect-MicrosoftTeams
Enter a username and password of your Global Administrator or Microsoft Teams administrator.
Microsoft Teams retrieve with PowerShell?
Get-Team
Command presets from Teams
Get-Command -Module MicrosoftTeams
Meetingpolicies via PowerShell
Get-CsTeamsMeetingPolicy
Make adjustments to store meeting recordings, for example, on OneDrive instead of Microsoft Stream
Set-CsTeamsMeetingPolicy -Identity global -RecordingStorageMode OneDriveForBusiness
Create a new Microsoft Team via PowerShell
New-Team -DisplayName 'test team'
Delete a Team via PowerShell
Remove-Team -GroupId ebae4935-4654-426e-b49c-7d16372899f8
Retrieve a Team with PowerShell
Install the PowerShell module from Azure AD via:
Install-Module AzureADPreview
Connect-AzureAD to connect to Azure Active Directory
Connect-AzureAD Restore-AzureADMSDeletedDirectoryObject -Id ebae4935-4654-426e-b49c-7d16372899f8
The group ID can be found via: Get-Team
Adding private channels to a Team
New-TeamChannel -GroupId f98369f6-24d6-4b8d-aa1c-ca5a3e0a94f7 -DisplayName "Internal Communications" -MembershipType Private New-TeamChannel -GroupId f98369f6-24d6-4b8d-aa1c-ca5a3e0a94f7 -DisplayName "External Services" -MembershipType Private New-TeamChannel -GroupId f98369f6-24d6-4b8d-aa1c-ca5a3e0a94f7 -DisplayName "Finacial" -MembershipType Private
Adding users to a team
add-teamuser -groupid 4c7de4c1-3b14-46a2-bd30-675de9c080a8 -user Jef@365tips.be
add-teamuser -groupid 4c7de4c1-3b14-46a2-bd30-675de9c080a8 -user dirk@365tips.be
add-teamuser -groupid 4c7de4c1-3b14-46a2-bd30-675de9c080a8 -user Piet@365tips.be
Don't know where to start?
Install get-help!
Get-help
Get-help helps!
Other helpful Teams blogs, here. All of Office 365 's portals can be found here .