I came up to create this easy script (with a little bit of help) because I wanted to bulk assign users an E3 license but without assigning Exchange Online functionality. The scripts I found on the internet were way to complex or just not working.
You can have several reasons why you do not want to assign every part of the license to a user. In my case mailboxes for this customer would not be migrated to Office 365 for the next months and therefor I don’t want Office 365 to create a mailbox for these users.
The script below should however a little bit being modified to suit your specific tenant. To start you will need to connect Powershell to Office 365 with the cmdlet Connect-MsolService. After this you will need to perform the following cmdlet to retrieve your AccountSKU Get-MsolAccountSku. This is needed because this will identify your tenantname and will show you which license you have to provide in the script.
The output will be something like this. Note that the blogoffice:ENTERPRISEPACK is used in the script twice. ENTERPRISEPACK is the reference for the E3 license. Other SKU’s can be found here http://blogs.technet.com/b/treycarlee/archive/2013/11/01/list-of-powershell-licensing-sku-s-for-office-365.aspx
If you want to provide more disabled plans you can do so by adding a , in between the plans like this -DisabledPlans @(“EXCHANGE_S_ENTERPRISE”,”SHAREPOINTENTERPRISE”)
Your UsageLocation can be adjusted as well of course to En-Us or something entirely different. Now copy the script (between the lines only) and save it somewhere as script.ps1
$AccountSkuId = “TENANTNAME:ENTERPRISEPACK”
$UsageLocation = “NL”
$LicenseOptions = New-MsolLicenseOptions -AccountSkuId TENANTNAME:ENTERPRISEPACK -DisabledPlans @(“EXCHANGE_S_ENTERPRISE”)
$Users = Get-Content c:\temp\users.txt
foreach ($user in $users)
#New-MsolUserLicense -UserPrincipalName $user
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses $AccountSkuId
sleep -Seconds 5
Set-MsolUserLicense -UserPrincipalName $user -LicenseOptions $licenseoptions
Set-MsolUser -UserPrincipalName $user -UsageLocation $UsageLocation
The next step is to make sure you have your users UPN’s in a txt file each one on the next line. In the script above I have users.txt saved in the temp folder on the c drive. Now just navigate to your c:\temp folder from Powershell and run the script by doing .\script.ps1
Now your users will be licensed one by one with small pauses of 5 seconds.