Share via

O365 - Powershell Help

Anonymous
2017-10-05T14:59:49+00:00

I am trying to license users who already have a license assigned.  For example, I have students who have been assigned Office 365 A1 for students and Office 365 ProPlus for students.   In these, students are assigned only Yammer, Office Online for Education and SharePoint Plan 1 for EDU.  I need to also assign Exchange Online (Plan 1) as well to the existing students.  However when I run the following script, I get the error:

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.

##### Creds to license accounts in O365 #####
$Username = "somecompany@microsoft.com"
$Password = ConvertTo-SecureString "SomePassword" -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential $Username, $Password  

Connect-MsolService -Credential $cred

$StudentUsers = Get-Content -Path "pathfile\users.txt"

Foreach ($user in $StudentUsers){
$LogPath = "logpath\$user.log"

$AccountSkuIdStandard = “CORRECT_SUBSCRIBTION"

$ExchangeOnlineSku = New-MsolLicenseOptions -AccountSkuId $AccountSkuIdStandard -DisabledPlans AAD_BASIC_EDU,SCHOOL_DATA_SYNC_P1,STREAM_O365_E3,TEAMS1,Deskless,FLOW_O365_P2,POWERAPPS_O365_P2,RMS_S_ENTERPRISE,OFFICE_FORMS_PLAN_2,PROJECTWORKMANAGEMENT,SWAY,MCOSTANDARD

#Applies standard license disabling plans
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses $AccountSkuIdStandard -LicenseOptions $ExchangeOnlineSku

Add-Content -Path $LogPath "$timestamp Attempting to license $user for O365 Exchange Online for Students"

Write-Output "Pausing script...."
Start-Sleep 3

Add-Content -Path $LogPath "$user has been licensed for O365 Exchange Online for Students"
}

My understanding is because the user is already assigned for a license so therefore they cannot be assigned another one.  

Is there a way to assign a plan (Exchange Online (Plan 1)) when a user already has a license?

I have over 10k users that I need to assign this plan/license to.

Microsoft 365 and Office | Subscription, account, billing | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2017-10-06T08:36:05+00:00

Hi PriscillaM1,

We can assign another license to a user who has already been assigned a license.

Considering your situation, I would like to suggest you referring to the following article:

Office 365 License Reporting and Management Tool -Assign Remove Licenses in Bulk

Please extract the file and navigate to license_mgmt.ps1, right-click and choose with Run with PowerShell.

Enter the admin credentials for your Office 365 tenant and click Generate.

After generating the licensing report, select the exist users and click Action and select Manage License.

Follow the wizard, and you can select the licenses and services like the picture below.

For further help, please let us know.

Regards,

Zixuan

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2017-10-11T12:06:14+00:00

    Hi PriscillaM1,

    Have you succeeded to assign the license to the student by using Office 365 License Reporting and Management Tool?

    Please share the status with us at your convenience.

    Regards,

    Zixuan

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2017-10-09T14:38:43+00:00

    Hi PriscillaM1,

    It won't take much time, and comparing with PowerShell cmdlet, it’s much more convenience.

    Regards,

    Zixuan

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2017-10-06T15:09:49+00:00

    Thanks Zixuan,

    How long does it take for the report to generate?

    Was this answer helpful?

    0 comments No comments