Solved

Office 365 Powershell

Posted on 2015-01-09
4
738 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 41

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 41

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
Microsoft is moving in-place eDiscovery & hold from ECP to EOP console under Content Search in Search and Investigation Options.  In this post, I will be showing you how to export emails to a PST file using the Content Search Options.
This Experts Exchange lesson shows how to use VBA to loop through rows in Excel.  In order to sort, filter, and use database features, there needs to be a value in each column for every row. When data arrives with values missing, code to copy values…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 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