Why does
get-vm | FT name, powerstate
not return the powerstate and only the name....I feel like I am missing something basic here.....
Check your Powershell console size and see if there is a horizontal scroll bar. I tried it on mine and did not see the expected result and then realized that the PowerState was right-aligned.
You can fix this by using -AutoSize which will put the two columns together.
If this is your issue you can also adjust the horizontal buffer size.
Keep in mind that anytime your Buffer size is greater than your Window Size width you'll have the scrollbar.
You should do this instead.
Get-VM | Select Name, PowerState
So you need to use "Select" or "Select-Object"
You can also use Select * to view all objects.
Check your Powershell console size and see if there is a horizontal scroll bar. I tried it on mine and did not see the expected result and then realized that the PowerState was right-aligned.
You can fix this by using -AutoSize which will put the two columns together.
If this is your issue you can also adjust the horizontal buffer size.
Keep in mind that anytime your Buffer size is greater than your Window Size width you'll have the scrollbar.
Hello, CRad14-
Hmm. It definitely should. And, it definitely does for me. I did not come up with much of a reason why it would not have.
One (seemingly unlikely) cause that I thought of is that the Name column is wide, causing the PowerState column to not be displayed. How many headers do you see at the top of the table (the top of the output)? Are there headers for both "Name" and "PowerState"?
Another thought was that you have a custom format.ps1xml file that is causing a display issue, but I would assume that you knew about such a file (it would be local to your machine, and probably placed there by you).
If there is some formatting causing the issue, you could use the -AutoSize parameter on Format-Table, like:
Get-VM | ft Name, PowerState -AutoSize
You could also use the Select/Select-Object alias/cmdlet as AureusStone suggested.
Both work and provide the same results as far as data.
Agree 100% on using Select * though to ensure that that PowerCLI is seeing the data that you are requesting. PowerState shouldn't be one of these items but you'll find that come up from time to time on other properties.
Ugh... I should have known better.. Thanks guys!