Last active
September 28, 2022 15:24
-
-
Save tuyendq/a48577791dd3b4052d73ec39263b38b8 to your computer and use it in GitHub Desktop.
Office 365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$today = Get-Date -Format yyyyMMdd | |
# Install the Microsoft Graph Powershell module | |
Install-Module Microsoft.Graph | |
# Install the Microsoft Azure AD module | |
Install-Module AzureAD | |
# Using credential | |
$credential = Get-Credential | |
Connect-AzureAD | |
# Disconnect the current session | |
Disconnect-AzureAD | |
# Connect to Azure AD | |
Connect-AzAccount | |
Get-AzADUser -UserPrincipalName <...@...> | |
# Connect to Exchange Online | |
Connect-EXOPSSession -UserPrincipalName <...@...> | |
Connect-MsolService | |
Get-MsolUser | Export-Csv -Path D:\\MicrosoftOffice365\Users-${today}.csv -NoTypeInformation | |
# Get specific mailbox statistics | |
$today = Get-Date -f yyyyMMdd | |
Get-MailboxFolderStatistics -Identity <...@...> -FolderScope All | select Name,ItemsInFolderAndSubfolders,FolderAndSubfolderSize | Export-Csv -Path mailbox-$today.csv -NoTypeInformation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment