Solved

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

Posted on 2015-01-12
7
1,779 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:kt KTAdmin
  • 4
  • 3
7 Comments
 

Author Comment

by:kt KTAdmin
ID: 40545284
Once found, how can I enable?
0
 
LVL 38

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:kt KTAdmin
ID: 40546465
They DO have a license but the Exchange Online is disabled.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 38

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:kt KTAdmin
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 38

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:kt KTAdmin
ID: 40548760
Thank you!
0

Featured Post

Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

Join & Write a Comment

Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now