Saturday, July 27, 2024

callum.foo

Blog posts and insights from SharePoint, Microsoft 365 & Azure

Microsoft TeamsPowerShell

Manage Microsoft Teams with PnP PowerShell

2020 was a strange year. Many employees across the world were asked to work from home full time. Microsoft Teams, which had already seen steady growth exploded in popularity, as organisations seeked to keep teams communicating effectively and working productively together. Microsoft have reported that it has now seen 200 million meeting participants in a single day. System admins now have the job of managing all these teams which have appeared in their Microsoft 365 tenant. As always, PowerShell is here to save the day. The team over at PnP PowerShell have created some great cmdlets which I would like to discuss in this post.

1. Install PnP PowerShell

Firstly, if you’re using the old version of PnP-PowerShell, you’re probably best off installing the new version.

If you need to uninstall the old version of PnP:

Uninstall-Module SharePointPnPPowerShellOnline

Installing the new version of PnP:

Install-Module -Name "PnP.PowerShell"

It really is that simple. If you find you have issues installing the new version of PnP, you might either be missing PowerShellGet or it could need updating.

To update PowerShellGet:

Update-Module -Name PowerShellGet

2. Connect-PnPOnline

Once you’ve got PnP.PowerShell installed, your next step is to connect to your Microsoft 365 tenant.

Connect-PnPOnline -Scopes "Group.ReadWrite.All" -Credentials "YourCredentials"

I’m not going to go in to detail about Connect-PnPOnline, since this documentation is already available on the PnP PowerShell site.

3. You’re good to go

Once you’re connected to your tenant you can take advantage of the PnP cmdlets in your scripts: