Link to home
Start Free TrialLog in
Avatar of Marty Nickison
Marty Nickison

asked on

PowerShell script to see what M365 services are being used in tenet

Good afternoon. I am wondering is there a PowerShell script that can gather all the M365 services (eg. Sharepoint, Email, Teams) that are currently turned-on in the tenet (being used at any level)?

I have looked around, but have not found the command that will get this done. However, the back of my mind keeps bugging me that it SHOULD exist.


Avatar of Kimputer
Kimputer

All explained here, though I'm not sure if that will answer your question fully. If not, sadly it's all MS offers:

https://docs.microsoft.com/en-us/microsoft-365/enterprise/view-licenses-and-services-with-microsoft-365-powershell?view=o365-worldwide
Here are the commands for all the services in a single block when you use the Microsoft Azure Active Directory Module for Windows PowerShell module.

But you also need to install all modules for it i.e.

Azure Active Directory (Azure AD), Exchange Online, SharePoint Online, Skype for Business Online and Teams:

Azure Active Directory V2
SharePoint Online Management Shell
Skype for Business Online, PowerShell Module
Exchange Online PowerShell V2
Teams PowerShell Overview

Go to section highlighted in below TechNet article in Black "Microsoft Azure Active Directory Module for Windows PowerShell module" and there you will find code.
Article- https://docs.microsoft.com/en-us/microsoft-365/enterprise/connect-to-all-microsoft-365-services-in-a-single-windows-powershell-window?view=o365-worldwide

Specify the name of your domain host and the UPN for the sign-in and run them all at one time.

Changes are required for only first 2 lines in the code i.e. your tenant name and UPN for global admin user.

Code:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$orgName="<for example, litwareinc for litwareinc.onmicrosoft.com>"
$acctName="<UPN of the account, such as belindan@litwareinc.onmicrosoft.com>"

$credential = Get-Credential -UserName $acctName -Message "Type the account's password."
#Azure Active Directory
Connect-MsolService -Credential $credential
#SharePoint Online
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -credential $credential
#Skype for Business Online
$sfboSession = New-CsOnlineSession -Credential $credential
Import-PSSession $sfboSession
#Exchange Online
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -ShowProgress $true
#Security & Compliance Center
Connect-IPPSSession -UserPrincipalName $acctName
#Teams
Import-Module MicrosoftTeams
Connect-MicrosoftTeams

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ASKER CERTIFIED SOLUTION
Avatar of Marty Nickison
Marty Nickison

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to divide points between 2 of us. It looks like asker solution was taken by you.