This works fine but shows the license in curly braces e.g. {“my tenancy”:STANDARDPACK} which when I pipe to export-csv then appears as System.Collections.Generic.List`1[Microsoft.Online.Administration.UserLicense]
Anyone know how I can resolve that so it shows the same as when it is output to the screen please?
That’s because Licenses is not a property; it is a collection that can contain multiple values. The curly bracket thing is what PowerShell does when you ask it to display a collection as a string on the screen. When you export, the curly bracket thing doesn’t come into play, and so you get the type name of the collection.
Will output a slash-delimited list of licenses. You can fiddle with that to get the look you want. I’m just guessing on what you might want to see, so this will probably require some adjusting.
It’s a property that contains a collection. Unforunately, I can’t run the same command so I cannot troubleshoot that for you. The syntax I gave may not be exactly correct for your situation, but it’s the general direction. It seems like the property is a collection of other objects, which means additional selecting would need to be done. Let me see what I can research.