Solved

Office 365 Powershell

Posted on 2015-01-09
4
681 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: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
  • 2
  • 2
4 Comments
 
LVL 40

Accepted Solution

by:
Vasil Michev (MVP) earned 500 total points
ID: 40540338
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:K Anthony O365
ID: 40540379
How can I assign the license to Bulk users, perhaps using a csv?
0
 
LVL 40

Expert Comment

by:Vasil Michev (MVP)
ID: 40540449
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:K Anthony O365
ID: 40540460
Excellent!

Thank you.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
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…

730 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