VMware Cloud Community
CRad14
Hot Shot
Hot Shot
Jump to solution

Quick Properties question

Why does

get-vm | FT name, powerstate

not return the powerstate and only the name....I feel like I am missing something basic here.....

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
0 Kudos
1 Solution

Accepted Solutions
aerodevil
Hot Shot
Hot Shot
Jump to solution

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.

  1. Right click on PowerCLI window Title bar
  2. Select properties
  3. Select Layout Tab
  4. Reduce Width under Buffer (mine set to 150)

Keep in mind that anytime your Buffer size is greater than your Window Size width you'll have the scrollbar.

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/

View solution in original post

0 Kudos
5 Replies
AureusStone
Expert
Expert
Jump to solution

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.

0 Kudos
aerodevil
Hot Shot
Hot Shot
Jump to solution

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.

  1. Right click on PowerCLI window Title bar
  2. Select properties
  3. Select Layout Tab
  4. Reduce Width under Buffer (mine set to 150)

Keep in mind that anytime your Buffer size is greater than your Window Size width you'll have the scrollbar.

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/
0 Kudos
mattboren
Expert
Expert
Jump to solution

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.

aerodevil
Hot Shot
Hot Shot
Jump to solution

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.

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/
0 Kudos
CRad14
Hot Shot
Hot Shot
Jump to solution

Ugh... I should have known better.. Thanks guys!

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
0 Kudos