Installing SharePoint Online Management Shell
To connect to SharePoint Online, you need to install SharePoint Online Management Shell. This PowerShell module allows you to manage SharePoint Online subscription in the Office 365. To install this module, PowerShell 3.0 (included in Windows Management Framework 3.0) must be installed on your computer. Download SharePoint Online Management Shell here.
Get-Command –Module Microsoft.Online.SharePoint.PowerShell (A complete list of available commands of the module Microsoft.Online.SharePoint.PowerShell.dll can be displayed in the way like this)
Install-Module Microsoft.Online.SharePoint.PowerShell
Get-Command *-SPO*
The most frequently used cmdlets are listed below:
- Add-SPOUser
- Connect-SPOService
- Disconnect-SPOService
- Get-SPOExternalUser
- Get-SPOSite
- Get-SPOSiteGroup
- Get-SPOTenant
- Get-SPOUser
- New-SPOSite
- New-SPOSiteGroup
- Remove-SPOSite
- Remove-SPOSiteGroup
- Remove-SPOUser
- Set-SPOUser
- Set-SPOUser
- Test-SPOSite
- Upgrade-SPOSite
Depending on your OS, you need to download 32 or 64 bit MSI distribution.
Connect to SharePoint Online
1. Connect-SPOService –Url https://contoso-admin.sharepoint.com
Get All SharePoint Online Site Collections
Get-SPOSite
Get-SPOSite –identity <SiteURL> | Select *
View All Users in the Site Collection
Find All External Users in SharePoint Online
List Deleted Sites Using PowerShell
Get SharePoint Online Tenant Settings
Find SharePoint Sites Linked with Private Channels
The template value “TEAMCHANNEL#0” denotes the site collection provisioned for each Teams private channel.
We have listed few SharePoint Online template IDs below:
STS#0 – Shows classic Teams sites
STS#3 – Lists Teams sites that has no connection to the Office 365 group
Group#0 – Retrieves Office 365 group associated Teams sites
Note: When a team is created, a Microsoft 365 group is generated. Each Microsoft 365 group creates a SharePoint site to store the shared documents. You can download our dedicated script to identify Teams and their SharePoint site URL.
Challenges in Managing SharePoint Online with PowerShell
SharePoint Online integrates multiple Office 365 components like Microsoft 365 groups, Teams, Private Channels, One Drive for Business, etc. So, the SharePoint Online PowerShell module alone is insufficient to generate all the SPO reports.
- It requires juggling multiple Office 365 PowerShell modules.
- For auditing SharePoint Online, you need to create an Exchange Online PowerShell session to use the Search-UnifiedAuditLog cmdlet.
- Sending a report by email is one of the tedious tasks.
No comments:
Post a Comment