Search code examples
powershellwmiget-wmiobject

How to list all properties of a PowerShell WMI object


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?


Solution

  • 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*