If you're trying to automate Microsoft Teams creation, use the Teams PowerShell module:
https://learn.microsoft.com/en-us/powershell/module/teams/new-team?view=teams-ps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am running a Windows 10 Professional machine with the latest version of PowerShell and running the following modules: AzureAD 2.0.2.106, SharePointPnPPowerShellOnline 3.24.2008.1 and MicrosoftTeams 1.1.4
I am trying to write a PowerShell script to automate Team (Microsoft teams) creations. During the development, I've noticed that the template is constantly wrong. When I run the Get-SPOWebTemplate cmdlet, I am getting the following as available:
But when running the following script, it displays a different template:
#Define Config Variables
#Install-Module -Name SharePointPnPPowerShellOnline -Force
#Import-Module -Name SharePointPnPPowerShellOnline
$AdminCenterURL = "https://com-admin.sharepoint.com"
$SiteURL = "https://com.sharepoint.com/sites/DKClients-3"
$SiteTitle = "DK.Clients - 3"
$SiteOwner = "admin_roland@contoso.com"
$Template = "EHS#1"
$Timezone = 3 #(GMT+01:00) Brussels, Copenhagen, Madrid, Paris
Try
{
#Connect to Tenant Admin
Connect-SPOService -URL https://com-admin.sharepoint.com
#Check if site exists already
$Site = Get-SPOSite -Limit ALL | Where {$_.Url -eq $SiteURL}
$DeletedSite = Get-SPODeletedSite -Limit ALL | Where {$_.Url -eq $SiteURL}
If ($Site -eq $null) {
If ($DeletedSite -ne $null) {
Remove-SPODeletedSite -Identity $SiteURL
write-host "Site $($SiteURL) was found in Recycle Bin and is now permanently deleted." -foregroundcolor Yellow
}
#sharepoint online pnp powershell to create communication site
New-SPOSite -Url $SiteURL -Owner $SiteOwner -StorageQuota 1024 -LocaleID 1033 -Template $Template -TimeZoneId $Timezone -Title $SiteTitle
write-host "Site Collection $($SiteURL) created successfully!" -foregroundcolor Green
}
else {
write-host "Site $($SiteURL) exists already! Create a new URL and rerun the script." -foregroundcolor Yellow
}
}
catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
In the SharePoint Admin Center, it is display as: Team site (classic experience) instead of Team site. I have tried GROUP#0 and EHS#1 without success. When I manually create a new Team site, it uses the GROUP#0 template. But this is not possible using a PowerShell command.
QA:
If you're trying to automate Microsoft Teams creation, use the Teams PowerShell module:
https://learn.microsoft.com/en-us/powershell/module/teams/new-team?view=teams-ps