Skip Ribbon Commands
Skip to main content

Quick Launch

Todd Klindt's home page > Todd Klindt's Office 365 Admin Blog > Posts > Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell
June 25
Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

Throughout my IT career I have had to create tens (or hundreds, or thousands) of objects to test something. It could be a bunch of Windows Users, a bunch of folders, files, etc. It seems like every time that happens I end up starting from scratch on the process. To stop that silly cycle I decided to make the process official by blogging it. Let’s stop this madness!

This time it started with my friend Michal Pisarek posting this tweet:

image

Orchestry needs to test their lifecycle features and he wanted to stress test it real good!

As is often the case, I see a tweet like that and my first thought is “Challenge Accepted!” The mechanics of how to create Teams with PowerShell is pretty simple but where this really gets tricky, at least for me, is the names. Especially if you’re looking at creating 20,000 like Michal is. In the past the way I’ve handled that is the old tried and true “Adjective Noun Number” formula. To get near 20,000 I wanted a long list of nouns and adjectives to pull from. I scoured the Internet and pulled together two files, nouns.txt and adjectives.txt. You can find them in this GitHub repo. Then I tack a random two digit number at the end to reduce the chance of collision. I put those files in the same directory as this PowerShell script and let ‘er rip!

Connect-PnPOnline -Url https://CONTOSO-admin.sharepoint.com -Interactive

# import the files with nouns and adjectives
$Nouns = Get-Content .\nouns.txt
$Adjectives = Get-Content .\adjectives.txt

# Number of Teams to create
$NumberOfTeams = 3
$Index = 1

while ($Index -le $NumberOfTeams) {
    # Generate Random stuff
    $TeamNoun = $Nouns | Get-Random
    $TeamAdjective = $Adjectives | Get-Random
    $TeamNumber = Get-Random -Maximum 100
    $TeamDisplayName = "$TeamAdjective $TeamNoun $TeamNumber"
    Write-Host "$Index - $TeamDisplayName"
    New-PnPTeamsTeam -DisplayName $TeamDisplayName -MailNickName $($TeamDisplayName.Replace(" ","")) -Description $TeamDisplayName -Visibility Public -AllowGiphy $true
    $Index++
}

You can find the file CreateLotsofTeams.ps1 in that same GitHub repo.

You can alter the nouns and adjectives files as you see fit. Set the the $NumberofTeams variable to how many Teams you want and you’re set. This script uses the venerable PnP.PowerShell module. You’ll need that installed and its Azure Application registered before you can run this. Be sure to change the Connect-PnPOnline line to reflect your tenant’s name, unless you actually work for Contoso.

Because of some weird timing, the current version of the PnP.PowerShell, 1.6.0, won’t work with this script as there is a bug in New-PnPTeamsTeam that prevents it from actually creating a Team. Ironic, I know. I put notes in the CreateLotsofTeams.ps1 file on how to handle that. But if you’re running it and it looks successful but no Teams are being created, look there first.

Also, for whatever reason, when you look at the Groups Sites in SharePoint they don’t show up as being Teams enabled, but they really are.

image

You can see in this crudely mocked up screenshot that the Teams are in the Teams client even though SharePoint Admin Center swears they don’t exist.

And while this script’s purpose in life is to create lots and lots of Teams, it could be easily modified to create lots and lots of anything. If you just need Groups, swap out New-PnPTeamsTeam with New-PnPMicrosoft365Group. If you just need SharePoint sites, use New-PnPTenantSite. Folders? Add-PnPFolder. I think you see where I’m going with this. Smile 

If you’re like Michal and you’re going to create 20,000 Teams, or anything, I hope you have a comfortable chair. It’s going to take a while. Michal is seeing about 1 Team a minute. It’s going to take him a couple of weeks at that pace. Almost certainly PowerShell is the bottleneck in this situation. If you’re looking at a similar situation, my advice is to open up another PowerShell window and run another instance of CreateLotsofTeams.ps1 there. And maybe run a few instances on another machine entirely. In the past that has helped me speed this things up considerably.

Enjoy.

tk

ShortURL: https://www.toddklindt.com/PoshLotsandLotsofTeams

Comments

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

The Home Storage is among the best public storage facility in a centralized location in Al qouz Dubai offering storage units of all sizesthehomestoragedubai https://www.thehomestoragedubai.com
 on 10/3/2023 2:43 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

BeClink - Your Destination for alcohol free beverages https://beclink.com/: Enjoy 15% Off Your First Order with Code FIRSTCLINK. Discover Non-Alcoholic Wines and More.
 on 10/3/2023 7:55 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

Looking for cash for cars montreal in laval https://montrealautorecyclage.ca/cash-for-cars-montreal-in-laval/? Montreal Auto Recyclage is your go-to solution. Get top-dollar offers and quick cash for your vehicles. Discover more on our website now.
 on 10/3/2023 8:07 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

In search of the best CPA San Diego has to offer? Abbo Tax CPA stands out with its unwavering focus on business owners. We cater exclusively to businesses across various industries, offering expert tax and accounting services. With prompt responses, personalized attention, and proactive advice, we strive to be the backbone of your business's financial success. explore more https://www.abbotax.com/ about our specialized offerings on our website now!
 on 10/5/2023 8:54 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

Order cannabis online and experience hassle free shopping throughout USA and CA Explore a wide range of CBD and THC edibles, Waxx Barz disposables, and moreOrder Cannabis Online http://www.organesh.com/se/classifieds/104247/113894/the-ultimate-guide-to-ordering-cannabis-online-everything-you
 on 10/7/2023 1:16 AM

iyredjure563i``

This specific is a great article My spouse and i witnessed due to talk about the idea. It is definitely precisely what I want to to view expect throughout potential you can proceed pertaining to expressing a real exceptional article.바카라사이트 순위 https://boxtreegifts.com/해외-온라인-바카라-사이트/
 on 10/8/2023 2:50 AM

XDGDRFEH

Cool Air Tech is your go-to Anaheim Air Conditioning Repair provider since 1996. With a team of factory-trained, certified HVAC contractors, we offer top-notch services, sales, and repairs. Explore our website to learn more.Air Conditioning Services Anaheim https://heyir59755.bloggersdelight.dk/2023/10/05/cool-air-tech-your-trusted-orange-county-air-conditioning-heating-experts-2/
 on 10/9/2023 1:05 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

Thanks a lot for ones put up not to mention amazing tips and hints.. perhaps even I just even consider that chores might be the most significant part of buying victory.Blue Vibe CBD Gummies https://www.mid-day.com/lifestyle/infotainment/article/fraud-warning-blue-vibe-cbd-gummies-reviews-shocking-scam-alert-must-read-23312538
 on 10/10/2023 6:14 AM

Re: Create Lots of Test SharePoint Sites (or Teams or Groups) with PowerShell

Used to do like analyzing articles and reviews released on this web site. They are really spectacular and allows a whole lot of invaluable tips.UFABETเว็บแทงบอลถูกกฏหมาย https://ljpelectrician.com/ufabetเว็บแทงบอลถูกกฏหมาย/
 on 10/10/2023 6:35 AM

khatri saab

Game On Fire: Your Path to WoW Classic Mastery and Beyond. Explore the best of and WoWhead Armory on our website.wow armory https://gameonfire.io/
 on 10/11/2023 5:15 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Today's date *

Select a date from the calendar.
Please enter today's date so I know you are a real person

Twitter


Want a message when I reply to your comment? Put your Twitter handle here.

Attachments

 

 SysKit