How to list all properties of a PowerShell object

Powershell

Powershell Problem Overview


When I look at the Win32_ComputerSystem class, it shows loads of properties like Status, PowerManagementCapabilities, etc. However, when in PowerShell I do the below I only get back a couple:

PS C:\Windows\System32\drivers> Get-WmiObject -Class "Win32_computersystem"

Domain              : YYY.com
Manufacturer        : VMware, Inc.
Model               : VMware Virtual Platform
Name                : LONINEGFQEF58
PrimaryOwnerName    : Authorised User
TotalPhysicalMemory : 2147016704

How can I see all properties?

Powershell Solutions


Solution 1 - Powershell

Try this:

Get-WmiObject -Class "Win32_computersystem" | Format-List *
Get-WmiObject -Class "Win32_computersystem" | Format-List -Property *

For certain objects, PowerShell provides a set of formatting instructions that can affect either the table or list formats. These are usually meant to limit the display of reams of properties down to just the essential properties. However there are times when you really want to see everything. In those cases Format-List * will show all the properties. Note that in the case where you're trying to view a PowerShell error record, you need to use "Format-List * -Force" to truly see all the error information, for example,

$error[0] | Format-List * -force

Note that the wildcard can be used like a traditional wilcard this:

Get-WmiObject -Class "Win32_computersystem" | Format-List M*

Solution 2 - Powershell

If you want to know what properties (and methods) there are:

Get-WmiObject -Class "Win32_computersystem" | Get-Member

Solution 3 - Powershell

You can also use:

Get-WmiObject -Class "Win32_computersystem" | Select *

This will show the same result as Format-List * used in the other answers here.

Solution 4 - Powershell

I like

 Get-WmiObject Win32_computersystem | format-custom *

That seems to expand everything.

There's also a show-object command in the PowerShellCookbook module that does it in a GUI. Jeffrey Snover, the PowerShell creator, uses it in his unplugged videos (recommended).

Although most often I use

Get-WmiObject Win32_computersystem | fl *

It avoids the .format.ps1xml file that defines a table or list view for the object type, if there are any. The format file may even define column headers that don't match any property names.

Solution 5 - Powershell

The most succinct way to do this is:

Get-WmiObject -Class win32_computersystem -Property *

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionlara400View Question on Stackoverflow
Solution 1 - PowershellKeith HillView Answer on Stackoverflow
Solution 2 - PowershellmanojldsView Answer on Stackoverflow
Solution 3 - PowershellRikelsView Answer on Stackoverflow
Solution 4 - Powershelljs2010View Answer on Stackoverflow
Solution 5 - PowershellKellen StuartView Answer on Stackoverflow