Author Posts

March 1, 2018 at 10:41 pm

Prior to 5.1 (or maybe earlier), when results containing objects were displayed, the name of the field was displayed – e.g. VerifiedDomains in the example below.

>$adtd=Get-AzureADTenantDetail ; $adtd

ObjectId                             DisplayName            VerifiedDomains
--------                             -----------            ---------------
85b5ff1e-0402-400c-9e3c-0f9e965325d1 Coho Vineyard & Winery {class VerifiedDomain {...

Now however, FT now 'simplifies' the name, e.g. VerifiedDomain as shown below

>$adtd=Get-AzureADTenantDetail ; $adtd

ObjectId                             DisplayName         VerifiedDomain
--------                             -----------         --------------
a34d9988-c5e2-4aff-86f5-54a1b18c68bd Contoso M365x295334

This renders simple display of objects – e.g.


useless for exploratory scripting – the object returned doesn't have a VerifiedDomain field, the field is VerifiedDomains.

Is there a workaround or setting to revert to the older behaviour? – currently I'm doing

>$adtd | fl


>$adtd | gm

to see the actual fields

Thanks for any guidance

March 1, 2018 at 10:47 pm

There are some tricks about the formatting system. This isn't a 'behavior change,' per se – it's how the thing works.

If it isn't given a predefined formatting view (from a .ps1xml file), it uses property names (they're technically not "fields"). If it _is_ given a formatting view, then it uses whatever's defined in that view. That's why you see column. headers in Get-EventLog output, for example, which aren't property names.

So at some point you wound up with a formatting view for that object type, and PowerShell is displaying it. Either that, or you had one before, and a module update or something -changed- the formatting view to what you see now. Get-Member is the One True Way to see the actual property names; tables are meant as a _view_, not as a canonical source of programming information. Much like in a report, tables may "prettify" things. And it happens on a lot of objects you may just have never noticed.

March 1, 2018 at 10:50 pm

Thanks – it's the first time I've noticed it with the AzureAD cmdlets, so there probably has been a change in the AzureAD module formatting view – Get-Member it is then.