Solved

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

Posted on 2015-01-12
7
2,096 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
  • 4
  • 3
7 Comments
 

Author Comment

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

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 40

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 40

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

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.

Question has a verified solution.

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

This is my first article on Expert Exchange on the Manual Method of Exporting Office 365 Mailboxes to PST format by using the eDiscovery mechanism of Office. Hope you will enjoy the article.
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
how to add IIS SMTP to handle application/Scanner relays into office 365.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

830 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