Jump to content

Recommended Posts

Posted

Hello

 

Would someone mind telling me what I am doing wrong here? I am connecting to the right bits Online etc

 

Import-Csv c:\users\manager\desktop\test.csv | ForEach-Object {get-msoluser -SearchString $_.UserPrincipalName |Set-MsolUserLicense -AddLicenses XXXX:OFFICESUBSCRIPTION_STUDENT}

 

I hate PowerShell!

 

Thanks

Posted (edited)
I used the command: Get-MsolUser -UnlicencedUsersOnly -All| Set-MsolUserLicense -AddLicenses :OfficeSUBSCRIPTION_STUDENT. I did have to set the location to GB first - I don't have the command to hand I used. Try adding a licence through the web interface - when I did that I was prompted to set location. Edited by clareq
Posted
You could also chuck in a | Where-Object {$.fieldname -like "your_value_here"} to limit your msolUser call to just students if you have a unique field (assuming both your staff and students are in 365 that is)
Posted

This is the script we are going to use. In my case it returns 950 results as our student accounts all start with STU..

 

$users = Get-MsolUser -all | Where-Object {$_.UserPrincipalName -like "STU*-*" }

foreach ($user in $users)

{

Set-MsolUserLicense -UserPrincipalName $user.UserPrincipalName -AddLicenses "BLAH:OFFICESUBSCRIPTION_STUDENT"

}

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...