Solved

Office 365 Powershell

Posted on 2015-01-09
4
581 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 39

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 39

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
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…

910 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

23 Experts available now in Live!

Get 1:1 Help Now