How to find properties of an object?

How to find properties of an object?

How can I find what properties object $a has in the following?
$a = 1
$a.length
$a | Get-Member

Get-Member does not seem to produce any properties for object $a? Is length a property of object $a?

Solutions/Answers:

Solution 1:

$a is an Integer, it doesn’t have a length property. Using Get-member is the right way to find object properties.

Solution 2:

You can also pipe a sample object to Select-Object to see all properties and their values.

get-process | select -first 1 -prop *

References

Loading...