Getting Inbox or Mailbox Rules in Office365 via Powershell

First, login to your tenant via Powershell using Microsoft’s new Exchange V2 Powershell module.

We’re going to be using the Get-InboxRule commandlet. If you run it outright, you’ll see a limited list of Inbox rules across your tenant. To narrow things down, you can use Get-InboxRule -Mailbox [user] to get rules for a specific user. Using the -Identity parameter will not work for this! Identity is for specifying specific Inbox rules. You can use wildcards, so you could do Get-InboxRule -Mailbox jeff*

The results will be:

From here, you can use the -Identity parameter to get information on specific rules such as their date of creation, what they actually do, and more!

Check it out.

Locating IMAP and POP Enabled from Mailboxes in Office365 Using Powershell V2 Module

Using Microsoft’s recently released Exchange Online PowerShell V2 Module, we can easily find IMAP and POP from mailboxes in Office365 via Powershell.

Finding IMAP and POP Mailboxes, Powershell V2:

Get-EXOCASMailbox -Filter {IMAPEnabled -eq $True -or POPEnabled -eq $True}

If you’d like to disable, take a look at my next post about doing that!

Office365 Powershell One-Liner: Find Emails Stuck in Users’ Outboxes

I wrote this quick and dirty one-liner to help monitor and find stuck emails in Exchange / Office365 mailboxes across a tenant and export the list as a CSV.

Get-Mailbox -ResultSize Unlimited | Get-MailboxFolderStatistics | Where-Object {$_.Name -eq "Outbox" -and $_.ItemsInFolder -gt '0' } | Select-Object Identity, FolderType, ItemsinFolder, FolderSize | Export-CSV "C:\CSVs\Outbox.csv"

Fixing Server Error in ‘/owa’ Application Error

Ran into this one today… and it is  nothing you want to see happen on an Exchange server! I was re-assigning services to a new SSL certificate when I started getting this error. After doing some searching, I found the easy fix from Microsoft. Under Server Config > Client Access, you can click Reset Virtual Directories on the far right. From there, you can choose which directories to rebuild (OWA, Autodiscover, etc.) Doing that fixed my issue for OWA!

 

 

More info can be found in Microsoft’s Technet Article: https://technet.microsoft.com/en-us/library/ff629372(v=exchg.141).aspx

Sharepoint Error – User Not in Directory

Had an odd one today. An internal user with permissions to a Sharepoint site was getting the error “user not in directory”. Searching Google comes up with many different options and reasons for this error, but no concise cause / solution.

The user was able to login to Office365 webmail normally without any errors and was had a Sharepoint license for several weeks and hadn’t reset their password recently.

Eventually, I had the user un-invited and then re-invited and it worked!

MailboxImportRequest Fails

I ran into an issue with a Powershell script I wrote recently, where I received this error:

The name must be unique per mailbox. There isn’t a default name available for a new request owned by mailbox xyz

Basically, a record is kept for completed mailbox move requests, and if you do too many for one mailbox, you get the above error. Don’t worry! Just run the following command in PS to clear away the completed request records, and you’ll then be able to run the import request!

 

Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest

That’s it!

How To: Disable Clutter in Office365

To disable Clutter in Office365 via Powershell, simply do the following:

Connect to Office365 Powershell for your account

Then simply run this command to disable Clutter for all mailboxes:

Get-Mailbox | Set-Clutter –enable $false

That’s it! If you want to disable Clutter for a single mailbox, you can do the following:

Set-clutter -identity user@email.com-Enable $false

To do this via the Office365 Portal, just navigate to: Mail > Automatic Processing > Clutter and turn it off!

How to Find Last Logon Time for Exchange Mailbox Users

The last logon time of an Exchange 2010/2013/2016 mailbox user can easily be found by running the Get-MailboxStatistics cmdlet in the Exchange Management Shell.

 

You can further sort the info by including and running the following command:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending

And export it to a CSV by adding an Export-CSV option like below:

Get-MailboxStatistics -Server EXCH | Sort LastLogonTime -Descending | Export-CSV c:\lastlogon.csv

Editing Calendar Permissions in Office365 via Powershell

First you need to connect to Office365.

Next, simply run this commandlet:
Add-MailboxFolderPermission calendar@company.com:\Calendar User guy@company.com AccessRights Author

Your accessrights options are: Owner, PublishingEditor, Editor, PublishingAuthor, Author, NonEditingAuthor, Reviewer, Contributor, AvailabilityOnly, LimitedDetails

If you’d like to get permissions, you can simply use:
Get-MailboxFolderPermission Identity calendar@company.com:\Calendar User guy@company.com

Finally, to remove permissions:

RemoveMailboxFolderPermission Identity calendar@company:\calendar user dude@company.com

Disable the Calendar on a User or Shared Mailbox In Exchange

This works for Office365 or an internal Exchange server to disable the calendar on a Shared Mailbox or User’s Mailbox. First, you’ll have to pull up the Exchange Management Shell. Then run the following commands:

New-OwaMailboxPolicy –Name “New Policy Name”

Creates a new mailbox policy


Set-OwaMailboxPolicy –Identity “New Policy Name” –CalendarEnabled $false

Sets the calendar for all mailboxes under the policy to be off

Set-CASMailbox –Identity “shared mailbox” –OwaMailboxPolicy “newpolicy”

Applies the policy to the mailbox in question