0

Right now I'm calling WriteObject(identities1, enumerateCollection:true) first and then WriteObject(identities2, enumerateCollection:true).

If identities1 and identities2 are the same type, the output looks okay. But if they are different types, the output for identities2 is blank.

What did I do wrong here?

1 Answer 1

1

This is quirk of how the PowerShell formatting (F&O) engine works. I've argued (apparently unsuccessfully) that this is a bug. You should find that the output is there if you use Format-List. Where I've seen this problem is that the first set of objects uses table formatting (either configured by a format ps1xml file or has <= 4 properties). Then the different object type has > 4 properties. PowerShell can't format the objects in tabular format so it just punts completely. I haven't tried this, but if you create a format ps1xml1 file for your output types, you could try to force both types to use list formatting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.