Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save baaamn/f090f082b8c7b41d6c4877a3fc7a58bb to your computer and use it in GitHub Desktop.

Select an option

Save baaamn/f090f082b8c7b41d6c4877a3fc7a58bb to your computer and use it in GitHub Desktop.
`Get-ChildItem Env:` only shows the *standard* properties exposed by the **first** environment variable object. To see **all** properties available across *all* objects, you must enumerate them and inspect their *combined* property set. Below are the **three best ways**, depending on what you want.

Powershell - Get all properties using 'Get-ChildItem Env:'

Short answer:
Get-ChildItem Env: only shows the standard properties exposed by the first environment variable object.
To see all properties available across all objects, you must enumerate them and inspect their combined property set.

Below are the three best ways, depending on what you want.


1. Show every property name that exists across ALL Env: objects

This gives you the union of all properties, not just the first one.

(Get-ChildItem Env: | ForEach-Object { $_.PSObject.Properties.Name }) |
    Sort-Object -Unique

This is the most complete answer to your question.


2. Show each object with all its properties (expanded)

This forces PowerShell to output every property instead of the default view:

Get-ChildItem Env: | Format-List *

This is the easiest way to visually inspect everything.


3. Show the full .NET type and its members

Environment variables in PowerShell are actually:

System.Collections.DictionaryEntry

To see all members:

Get-ChildItem Env: | Get-Member -Force

-Force shows hidden members too.


🧠 Why this happens

PowerShell formats output using the first object in the pipeline to determine which properties to display.
If later objects have additional properties, they are not shown unless you explicitly expand them.

This is why you only saw the properties from the first object.


If you want, I can also show:

  • how to export all env vars with all properties to JSON/CSV
  • how to inspect the underlying .NET dictionary
  • how to get environment variables from machine/user/process scopes
  • how to build a reusable function for “show all properties for any provider”

Just tell me what direction you want to go next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment