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.
# 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
Connect-MsolService –Credential $Creds
# Create session to Exchange Online
$EOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -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: https://outlook.office.de/powershell-liveid/ Be sure to disconnect the remote PowerShell session when you’re […]
Bulk Change Office 365 accounts UPN / Sign-in Names
If you synced your on-premises Active Directory (AD) without setting your users UPN attribute to use their email addresses or the custom domain you added to Azure AD, your users will have Office 365 usernames like [email protected] Changing the logon domain from the on-prem AD user settings will not help for existing users, but it […]
Set a user’s password to never expire on Office365
If you need to set a user’s password to never expire on your Office 365, you need to do that with PowerShell. And it is really easy. We save our credentials to a variable called $creds, running this command will open a Sign in to your account windows, so sign in with your Office 365 […]
Exchange – Office 365 Hybrid Configuration Wizard Can’t Start
The Exchange – Office 365 Hybrid Configuration Wizard application may not run as expected due to IE security settings for ClickOnce type applications, and the web page provides a link to the Wizard app which visits a few another URL’s until it reaches to the executable. There are workarounds on the Internet, that shows adding domains […]
Change Office 365 Portal Language Settings
I will try to show you a workaround that will help you to Change Office 365 Portal Language Settings for SharePoint based Applications. It is very useful especially if you gone mad as me when you can’t see the language settings under account settings : ) The problem is some Office 365 Online applications like OneNote […]