Solved

Office 365 Powershell

Posted on 2015-01-09
4
543 Views
Last Modified: 2015-01-09
Looking for a script to get all migrated mailboxes ending with @domain.com that is also assigned a certain E1 license.  (Not Get-MSOLuser, but those with a mailbox)

thank you!
0
Comment
Question by:kt KTAdmin
  • 2
  • 2
4 Comments
 
LVL 38

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
Comment Utility
You can achieve this with Get-MsolUser as well. The CloudExchangeRecipientDisplayType attribute will let you know whether the user has a mailbox associated with him in the cloud. The value you should be looking for is 1073741824 for UserMailbox. So, the following cmdlet will list all user objects that have associated UserMailbox and do not have a license:

Get-MsolUser -all | ? {$_.CloudExchangeRecipientDisplayType -eq "1073741824" -and $_.IsLicensed -eq $false}

Open in new window


To apply a license to those users, use something like this:

Get-MsolUser -all | ? {$_.CloudExchangeRecipientDisplayType -eq "1073741824" -and $_.IsLicensed -eq $false} | % {Set-MsolUserLicense -UserPrincipalName $_.UserPrincipalName -AddLicenses "contoso:ENTERPRISEPACK"}

Open in new window

0
 

Author Comment

by:kt KTAdmin
Comment Utility
How can I assign the license to Bulk users, perhaps using a csv?
0
 
LVL 38

Expert Comment

by:Vasil Michev (MVP)
Comment Utility
This will add license to ALL the users with mailbox and without a license. Just replace the relevant SKU at the end.
0
 

Author Closing Comment

by:kt KTAdmin
Comment Utility
Excellent!

Thank you.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

We are happy to announce a brand new addition to our line of acclaimed email signature management products – CodeTwo Email Signatures for Office 365.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…
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…

763 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

10 Experts available now in Live!

Get 1:1 Help Now