Tuesday, July 16, 2024
HomeMicrosoft 365ExchangeTop 10 Office 365 PowerShell Commands for Admins

Top 10 Office 365 PowerShell Commands for Admins

If you are IT administrator managing Office 365 (Microsoft 365) helps you to work more efficiently. You can access to all Microsoft 365 Admin Centers through PowerShell

Here are top 10 Office 365 PowerShell Commands for Admins

1.Connecting To Exchange Online

$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Cred -Authentication Basic –AllowRedirection
$Cred = Get-Credential to connect Exchange Online
Connecting To Exchange Online

2.Connecting SharePoint Online with PowerShell

Install-Module -Name Microsoft.Online.SharePoint.PowerShell

$orgName="<name of your Office 365 organization, example: contosotoycompany>"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
Connecting SharePoint Online with PowerShell

3.Connecting To Azure

Install-Module -Name AzureAD
Connect-AzureAD -Confirm
Connecting To Azure

4.Get all Azure Commands

Get-Command -module AzureAD

5.List all unlicensed users

Get-MsolUser -UnlicensedUsersOnly

6.All Mailbox report

Get-mailbox | get-MailboxStatistics

7. List all groups


8.Create a new SharePoint site

New-SPOSite -Url https://contoso.sharepoint.com/sites/newsite -Owner joe.healy@contoso.com -StorageQuota 1000 -Title "New site collection"

9. Removes a user or a security group from a site collection or a group.

Remove-SPOUser -Site https://contoso.sharepoint.com/sites/newsite -LoginName joe.healy@contoso.com -Group "new site Owners"

10. Gets a device from Active Directory


For more information click here

Most Popular