Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Format-Table confusion

$
0
0

Hi, I'm pretty new to PowerShell, but just when i though i had figured Format-Table out, this issue emerged..

 

I made some simple examples to illustrate my confusion, and I hope you understand what i mean :)

I am trying here to get $Info1 and $Info2 out to the host, in a table view, but only list gives all the information. Table only shows the first $Info1.

The difference is marked with bold.

 

Example #1

$Info1 = Get-Process -Name svchost | Select-Object @{Name='SomeInfo1';Expression={$_.Id}}

$Info2 = Get-Process -Name svchost | Select-Object @{Name='SomeInfo2';Expression={$_.Id}}

$Info1,$Info2 | Format-Table

 

 

Example #2

$Info1 = Get-Process -Name svchost | Select-Object @{Name='SomeInfo1';Expression={$_.Id}}

$Info2 = Get-Process -Name svchost | Select-Object @{Name='SomeInfo2';Expression={$_.Id}}

$Info1,$Info2 | Format-List

 

 

Im sure that i have gotten something wrong in my understanding of how the formatting work, and I would be glad if some of you explained that to me :)


Viewing all articles
Browse latest Browse all 8583

Trending Articles