We’re using Office 365, and I need to convert all of our users from one license to another. But staff/faculty get one license while students get another, so I need to select all fac/staff and then change their license.
Which seems like a likely way to select only staff/faculty. But:
Get-MsolUser -all | Where {_.Licenses -eq "{domain:STANDARDWOFFPACK_IW_FACULTY}"}
returns nothing. A user can have multiple licenses, so I tried -like and -contains as well, but no results. Am I misusing Where? Do the braces in the property value have a meaning I’m not allowing for?
Curly Braces on a property means that it is not a single value property. The property is multivalued. You can see that by getting one of your users and looking specifically at the license property.
That’s because AccountSkuID is a property of Licenses, which is a property of the MSOLUser. With the statement you have currently, it is looking for a property called AccountSkuID on your User Object, which does not exist. Your command should look like this:
Get-MsolUser -all | Where {$_.Licenses.AccountSkuID -eq "domain:STANDARDWOFFPACK_IW_FACULTY"}