
Get mailbox folder statistics from Exchange Online / Office 365
This short and simple example shows how to connect to Exchange Online services to get mailbox folder statistics from Exchange Online / Office 365 via PowerShell. Hope it helps.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# Sample PS to connect Exchange Online and to get mailbox and inbox folder item count. # Osman Shener # Get Credentials for Office 365 $Creds = Get-Credential # Connect to Office 365 services Import-Module MSOnline Connect-MsolService –Credential $Creds # Create session to Exchange Online $EOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $Creds -Authentication Basic -AllowRedirection Import-PSSession $EOSession -DisableNameChecking # The mailbox owner $TheUser = "Osman Shener" # Get total item count in the mailbox (all items) $TotalItemsCount = Get-MailboxStatistics -Identity $TheUser # Get total item count in the Inbox folder $InboxItemsCount = Get-MailboxFolderStatistics -Identity $TheUser -FolderScope Inbox # Print the results $TheUser + " has " + $TotalItemsCount.ItemCount + " items in the mailbox, " + $InboxItemsCount.ItemsInFolder + " of them are in the Inbox folder." |
Notes: For Office 365 operated by 21Vianet, use the ConnectionUri value: https://partner.outlook.cn/PowerShell For Office 365 Germany, use the ConnectionUri value: Be sure to disconnect the remote PowerShell session when you’re […]

How to add or remove extensionAttribute of an AD User object
I would like to share some simple PowerShell commands, to show how to add or remove extensionAttribute of an AD User object Import AD Module First [PS] C:\>import-module ActiveDirectory To get current value [PS] C:\>Get-ADUser -Identity firstuser -Properties extensionAttribute12 DistinguishedName : CN=First User,OU=TempTest,DC=infralib,DC=com Enabled : False GivenName : First Name : First User ObjectClass : user […]