VMware Cloud Community
alanrenouf
VMware Employee
VMware Employee
Jump to solution

Powershell properties

Hi, I have just started in powershell (completed my first script today http://teckinfo.blogspot.com/2008/06/my-first-powershell.html)

I was wondering if there was a command that would show me all properties of an item ? I often want to display information but am not sure of its property name.

Example... Get-VM | Select-Object -property "Name","PowerState","Description","NumCPU","MemoryMB"

Thanks

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Get-Member is one of your best friends Smiley Wink

Joking aside, have a look at Keith Hill's blog on Effective PowerShell


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership
Jump to solution

Get-Member is one of your best friends Smiley Wink

Joking aside, have a look at Keith Hill's blog on Effective PowerShell


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

Aha I see, thanks...

get-vm | get-member -Membertype property

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

Also, try "get-foo | format-list *" sometime. You'll find that most times, many properties are not displayed by default. This shows them all.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
alanrenouf
VMware Employee
VMware Employee
Jump to solution

Thanks guys, now to try and ammend my script in my first post to export information about each hosts CPU/Memory so that I can create a nice report in Excel and then draw pretty graphs!

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos