Author Posts

March 23, 2017 at 4:20 am

When sending PSObjects down the pipeline with only one or two properties, is there a way to force the default display to left align without using another pipeline invocation?

March 23, 2017 at 8:27 am

Your question is to vague to give a helpful answer ... could you explain that more precicly or show some code example?

March 23, 2017 at 9:47 am

New-Object -TypeName PSObject -Property @{
    ComputerName = $env:COMPUTERNAME
    AdDomain     = $env:USERDOMAIN
} | Format-Table ComputerName, AdDomain -Auto 

March 23, 2017 at 10:33 am

Hi Sam,
That was what I was trying to avoid (a pipeline invocation of Format-Table). What I wondered was if there was a means to override the default display of an object by possibly modifying it.

I can certainly pipe the output the output of the cmdlet to FT if that is the only solution.

I wonder why the default settings seem to left align output when only one or two fields are present? Seems odd and un-intuitive...

March 23, 2017 at 11:17 am

Hmmm ... I guess I have an idea of what you're after. I did not use it but I heard of it in this video from Don Jones and Jeffrey Snover Explore Powershell ... the part I mean starts at about 35 minutes