What do braces in property values mean?

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.

If I do:

Get-MsolUser -UserPrincipalName user@domain.edu | FL

One of the properties is:

Licenses                               : {domain:STANDARDWOFFPACK_IW_FACULTY}

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?

It means the property contains, or is designed to possibly contain, multiple items, and that’s the best PowerShell can do to render that as text.

That means the contents of the property aren’t simple values, necessarily, but potentially complex objects. -Contains can’t easily test for that.

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.

Get-MsolUser -UserPrincipalName curtis.smith@daltile.com | Select-Object -E
xpandProperty Licenses

By doing that you will see that the license name is actually stored under the “AccountSkuID” property.

Thanks! I’m really enjoying learning the Powershell, but getting all the information on all the properties is frustrating.

I’m sorry to keep beating this horse, but it’s still not giving me any results.

get-msoluser -UserPrincipalName awilliams@domain.edu | Select-Object -ExpandProperty Licenses


ExtensionData          : System.Runtime.Serialization.ExtensionDataObject
AccountSku             : Microsoft.Online.Administration.AccountSkuIdentifier
AccountSkuId           : domain:STANDARDWOFFPACK_IW_FACULTY


Get-MsolUser -all | Where {$_.AccountSkuID -eq "domain:STANDARDWOFFPACK_IW_FACULTY"}

returns no results.

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"}

Ah, I see. So I’m selecting a property of a property of a user object. Thanks!

I was about to ask the exact same question about the exact same issue!
Thanks so much for the solution!