get-member — List properties, methods, and events on a PowerShell object across all 5 shells
Equivalents in every shell
declare -p VARbash has no rich object model — variables are strings, arrays, assoc-arrays, or integers. `declare -p VAR` shows the type and value. `type cmd` shows whether something is a builtin / function / alias / external. For functions, `declare -f funcname` shows the body. None of this is "members of an object" — it's the closest bash equivalent.
typeset -p VARzsh's `typeset -p` is the equivalent of bash's `declare -p` — shows variable type + value. `whence -v cmd` is the zsh `type` equivalent. zsh modules (`zmodload`) extend the runtime with object-ish APIs (zsh/system, zsh/zutil) but `get-member` style introspection isn't a shell-native concept.
set --show VARfish's `set --show` displays the value of a variable across all scopes (global / universal / local) with type annotations. `functions -v funcname` shows function metadata. fish has no object model — variables are strings or lists of strings only.
$obj | Get-MemberReflects the .NET type. Lists every property (with type), method (with signature), event, alias property, scriptproperty. Aliased as `gm`. Default output groups by member type. `-MemberType Property|Method|Event|All` filters. `-Force` shows hidden members.
powershell -NoProfile -Command "$obj | Get-Member"cmd has no introspection — variables are strings only. `set VARNAME` displays a single variable; `set` (no arg) displays all. For real object introspection, shell out to PowerShell. Some COM objects can be poked at via `cscript` + JScript but that's a different language.
Worked examples
List all properties of an object
declare -p user_email user_id user_role$user | Get-Member -MemberType PropertySee what methods you can call
type cmd_name$obj | Get-Member -MemberType MethodInspect a single specific property
echo "${VAR@A}" # bash 5+ — A attribute prints declaration form$obj | Get-Member -Name EmailGotchas
- `Get-Member` works PER OBJECT, not per type — `(1, "two") | gm` produces TWO separate outputs (one for `[int]`, one for `[string]`) because the cmdlet runs once per pipeline item and groups by `.GetType()`. To inspect a TYPE's members (without an instance), use `[int] | Get-Member -Static` or reflection: `[int].GetMembers() | Format-Table Name, MemberType`.
- To inspect members of an ENTIRE array (rather than per-element), pass `-InputObject`: `Get-Member -InputObject $arr` shows the array's methods (`.Length`, `.Clone()`, …) instead of the element-type members.
- PowerShell adds SYNTHETIC members to many built-in types via `Types.ps1xml` — e.g. `[string]` gets a `Length` property that's native, but `[FileInfo]` gets `Mode` and `LastWriteTime` as alias / script properties. `Get-Member` shows them all; `-Force` is needed to also see the framework-hidden ones.
- Reflection-based access (`.GetMembers()`) returns the underlying .NET names, sometimes different from the PowerShell-visible names (PowerShell often adds `Get-` / `Set-` prefix wrappers). `Get-Member` shows the PowerShell-visible names — usually what you want.
- For COM objects, `Get-Member` works but is INCOMPLETE — late-bound COM members (set via `IDispatch`) don't appear because they're resolved at call time. Use `$comobj.GetType().InvokeMember(...)` or examine the type library via `OleViewDotNet` for the full surface.