Solved

Office 365 Powershell

Posted on 2015-01-09
4
647 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
  • 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

Are your AD admin tools letting you down?

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

Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This article explains how to install and use the NTBackup utility that comes with Windows Server.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
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…

839 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