Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2015-01-12
7
Medium Priority
?
2,828 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:Anthony K O365
  • 4
  • 3
7 Comments
 

Author Comment

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

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:Anthony K O365
ID: 40546465
They DO have a license but the Exchange Online is disabled.
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 44

Accepted Solution

by:
Vasil Michev (MVP) earned 1500 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:Anthony K 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 44

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:Anthony K O365
ID: 40548760
Thank you!
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

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

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
Stellar Exchange Toolkit: this 5 in 1 toolkit comes loaded with mega-software tool. Here’s an introduction to tools’ usage and advantages:
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Suggested Courses

810 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