Solved

Office 365 Powershell- How to find All users with Exchange Online disabled

Posted on 2015-01-12
7
2,242 Views
Last Modified: 2015-01-14
Need a Powershell one-liner to find all users with the Exchange Online disabled
-DisabledPlans:EXCHANGE_S_STANDARD
0
Comment
Question by:K Anthony O365
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:K Anthony O365
ID: 40545284
Once found, how can I enable?
0
 
LVL 41

Expert Comment

by:Vasil Michev (MVP)
ID: 40546034
Do you mean all users that DO have license but have the Exchange plan disabled, or any user that does not have an Exchange plan enabled, regardless of other plans?
0
 

Author Comment

by:K Anthony O365
ID: 40546465
They DO have a license but the Exchange Online is disabled.
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 41

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
ID: 40546543
OK, so if you insist on one-liner:

Get-MsolUser -All | ? {$_.Licenses.AccountSKUid -eq "tenant:ENTERPRISEPACK" -and ($_.CloudExchangeRecipientDisplayType -eq $null -or $_.CloudExchangeRecipientDisplayType -eq "6") } 

Open in new window


Replace the relevant SKU. The logic is to look at all the accounts that have the SKU assigned and use the CloudExchangeRecipientDisplayType to get only users without a valid mailbox (shared mailboxes are also excluded, even if they have license - the CloudExchangeRecipientDisplayType value for them is 0; UserMailbox is 1073741824)

If you want to do it a bit more detailed, I'd go for something like this:

$sku = (Get-MsolAccountSku) | ? {$_.ServiceStatus.ServicePlan.ServiceName -eq "EXCHANGE_S_STANDARD"}
$index = ($sku).ServiceStatus.ServicePlan.ServiceName.IndexOf("EXCHANGE_S_STANDARD")
Get-MsolUser -All | ? { ($_.Licenses) -and ($_.Licenses[-1].ServiceStatus[$index].Provisioningstatus -eq "Disabled") -and ($_.Licenses.AccountSkuId -eq $sku.AccountSkuId)}

Open in new window


There's still room for improvement, as it might give incomplete results if you have more than two SKUs assigned to a user (tested only with E3 and CRM ones).
0
 

Author Comment

by:K Anthony O365
ID: 40547025
Visil,

After changing the SKU in this script, nothing returned. Again, just to clarify: I have a few users with assigned SKU's but the Exchange part is unchecked (disabled). I want to find those users only.

thanks!!
0
 
LVL 41

Expert Comment

by:Vasil Michev (MVP)
ID: 40547192
The script runs fine for me, both do. Make sure you are indeed filtering only users with the correct SKU. If you are using E1 license, it will be tenant:STANDARDPACK, not tenant:ENTERPRISEPACK
0
 

Author Closing Comment

by:K Anthony O365
ID: 40548760
Thank you!
0

Featured Post

Office 365 Training for Admins

Learn how to provision tenants, synchronize on-premise Active Directory, and implement Single Sign-On with these master level course.  Only from Platform Scholar

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question