Chapter 03Lesson 02~90 minutes

Inspect Objects with Get-Member and Type Information

Learn to investigate unfamiliar PowerShell objects with Get-Member, property and method metadata, PSTypeNames, Select-Object, Format-List, and the practical parts of PowerShell’s Extended Type System.

BeginnerGet-MemberTypes

Learning objectives

By the end of this lesson

  • Use Get-Member as the primary discovery tool for the type, properties, and methods of unfamiliar pipeline objects.
  • Interpret common member categories including Property, AliasProperty, NoteProperty, ScriptProperty, and Method.
  • Explain the different purposes of Select-Object -Property * and Format-List *.
  • Inspect PSTypeNames and describe the Extended Type System as PowerShell’s adaptation/extension layer around objects.
  • Call a simple method safely while explaining why a cmdlet is often a better automation interface when one exists.

1. Get-Member is the microscope for unfamiliar objects

When a command gives you an object you have never seen before, guessing property names wastes time. Get-Member answers three foundational questions: what type is flowing, which members are available, and what kind of member is each one?

Get-Process -Id $PID | Get-Member

At the top of the result, TypeName identifies the incoming object type. The table underneath lists member names, member categories, and definitions. You do not need to memorize the list. The point is that the object is self-describing enough for systematic discovery.

2. How to read Get-Member output

ColumnQuestion it answers
TypeNameWhat kind of object am I inspecting?
NameWhat property, method, event, or extended member can I refer to?
MemberTypeWhat category of member is this?
DefinitionWhat type/value shape or method signature should I expect?
Get-Process -Id $PID |
    Get-Member -MemberType Properties |
    Select-Object -First 15 Name, MemberType, Definition

Filtering the member list is useful when the complete object has dozens or hundreds of members. Start broad once, then narrow by member type or name as your question becomes specific.

3. The member categories you need for DevOps work

PowerShell supports many member categories. Beginners do not need every internal distinction, but a few appear frequently in operational scripts.

Member typePractical meaningTypical use
PropertyData exposed by the underlying/adapted object.Read process Id, file Length, date components.
AliasPropertyAn alternate property name pointing at another property.A friendlier or compatibility name for existing data.
NotePropertyA value attached as a named property, common on PSCustomObject and imported data.Inventory records, API/config objects, calculated records.
ScriptPropertyA property whose value is produced by PowerShell code when read.Convenience/extended properties defined by PowerShell type data.
MethodCallable behavior on the object.Refresh an object, manipulate a string/date, invoke type behavior.
$p = Get-Process -Id $PID
$p | Get-Member -MemberType Property,AliasProperty,ScriptProperty
$p | Get-Member -MemberType Method | Select-Object -First 10

Not every object has every member category. A clean investigation asks what is actually present instead of assuming a fixed shape across all types.

4. Select-Object -Property * and Format-List * solve different problems

Select-Object is a data operation: it projects properties into output objects. Format-List is a presentation operation: it creates instructions for human display. They can look similar on screen while behaving differently downstream.

$p = Get-Process -Id $PID

$selected = $p | Select-Object -Property *
$formatted = $p | Format-List *

$selected | Get-Member | Select-Object -First 8
$formatted | Get-Member | Select-Object -First 8

The selected result remains a data object whose properties are intended for further processing. The formatted result is made of internal formatting objects. That is why you can safely export selected data but should normally avoid piping Format-* into data-processing or serialization commands. Lesson 05 makes this failure concrete.

5. Inspect values without losing the object model

Sometimes you need to see every property value for one object. Select-Object -Property * is useful when you want a projected object; Format-List * is useful when a human wants a detailed display.

$p = Get-Process -Id $PID

# Data projection
$p | Select-Object -Property *

# Human-oriented display
$p | Format-List *

If you are debugging an object shape for later automation, prefer Get-Member plus targeted property access. Dumping every property can be overwhelming and can accidentally evaluate expensive or access-restricted properties on some object types.

6. PSTypeNames and the Extended Type System

PowerShell sits on top of .NET objects but does not expose them as a raw reflection-only experience. Its Extended Type System (ETS) can adapt underlying objects and add members or type names that PowerShell uses for behavior and formatting.

$p = Get-Process -Id $PID
$p.PSTypeNames

PSTypeNames is an ordered list from more specific to more general type identities. PowerShell can use these names when choosing formatting and type extensions. You normally do not need to edit the list manually at this stage; you need to recognize that the PowerShell view of an object can include more than the raw .NET class alone.

$p | Get-Member -View Base | Select-Object -First 8 Name, MemberType
$p | Get-Member -View Adapted | Select-Object -First 8 Name, MemberType
$p | Get-Member -View Extended | Select-Object -First 8 Name, MemberType

The -View parameter lets you investigate whether members come from the base object, PowerShell adaptation, or PowerShell extensions. This is mainly a troubleshooting and deeper-discovery tool—not something you need for every pipeline.

7. Calling methods safely—and knowing when not to

A method call uses parentheses because you are invoking behavior on the object. Choose a harmless example first: a DateTime object can calculate another date without changing system state.

$now = Get-Date
$tomorrow = $now.AddDays(1)

$now
$tomorrow
$now | Get-Member -Name AddDays

The method is useful because it belongs naturally to the date object and returns another date. For administrative mutations, however, prefer an appropriate cmdlet when one exists. Cmdlets expose discoverable parameters, PowerShell help, common parameters, pipeline contracts, and often safety features such as -WhatIf.

8. Inspect the elements or inspect the collection itself?

This distinction causes many beginner surprises. When you pipe a collection to Get-Member, PowerShell enumerates it and inspects the element types. When you pass the collection through -InputObject, Get-Member treats the collection as one object.

$values = @(1, 'hello')

# Inspect the elements flowing through the pipeline.
$values | Get-Member

# Inspect the array container itself.
Get-Member -InputObject $values

The first form can report System.Int32 and System.String because those elements flow individually. The second reports the array type because the array object itself is the input. This is your first concrete view of pipeline enumeration versus passing a collection as one parameter value.

9. Investigation workflow for any new object

Use the following sequence whenever a new command, API module, cloud object, or imported record appears:

  • Identify the producer. Use Get-Command and help to know what command emitted the data.
  • Capture one representative object. Avoid flooding the screen with hundreds of items.
  • Inspect the type and members. Pipe that object to Get-Member.
  • Read the values you actually need. Use direct property access or Select-Object.
  • Keep formatting separate. Only use Format-* when the next consumer is a human.
$sample = Get-Process -Id $PID
$sample | Get-Member
$sample | Select-Object Id, ProcessName, StartTime
$sample.Id

10. Lab: investigate a real process object

The lab is read-only and cross-platform. Build a short evidence report for the process hosting your current session.

$sample = Get-Process -Id $PID

# Identify the object type.
$sample | Get-Member | Select-Object -First 15

# Find selected categories of members.
$sample | Get-Member -MemberType Property,AliasProperty,ScriptProperty
$sample | Get-Member -MemberType Method | Select-Object -First 10

# Compare data projection with human formatting.
$sample | Select-Object -Property Id, ProcessName, StartTime, WorkingSet64
$sample | Format-List Id, ProcessName, StartTime, WorkingSet64

# Inspect PowerShell type names.
$sample.PSTypeNames

Choose one property that did not appear in the default process table and retrieve it directly. Then choose one method, read its definition with Get-Member -Name, but do not invoke it unless you understand that it is read-only/safe.

Verification checklist

11. Common object-inspection mistakes

Dumping everything first. Start with one representative object and use Get-Member; giant property dumps hide the structure you are trying to learn.

Calling a method because it exists. Read the method signature and understand side effects. Prefer cmdlets for administrative changes when they provide a safer PowerShell contract.

Using Format-List * as if it returned the original data. It is for presentation. Use Select-Object or direct properties for data workflows.

Confusing an array’s members with its elements’ members. Pipeline enumeration and -InputObject can intentionally answer different questions.

12. Knowledge check

Question 1. What is the main purpose of Get-Member?

Question 2. What is an AliasProperty?

Question 3. Why is Select-Object -Property * safer for downstream data processing than Format-List *?

Question 4. What does PSTypeNames represent?

Question 5. Why can $array | Get-Member differ from Get-Member -InputObject $array?

13. Summary

Get-Member is your primary microscope for unfamiliar PowerShell data. It reveals type identity, properties, methods, aliases, and extensions without requiring guesswork. Select-Object reshapes data; Format-List reshapes presentation. PSTypeNames and ETS explain why PowerShell can adapt and extend underlying .NET objects. With these tools, you can inspect a new object before attempting to pipe it anywhere else.

14. Further reading

Next lesson

Understand how pipeline objects bind to parameters

Lesson 03 follows an object from one command to the next and explains pipeline binding by value and by property name, including a deliberate failure that you will diagnose with Get-Help and Get-Member.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0 Send only Ethereum/ERC-20 compatible assets to this address.