Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8884919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:10:55+00:00 2026-06-14T21:10:55+00:00

In PowerShell 2.0 on Win2008R2, if I want to get the same output from

  • 0

In PowerShell 2.0 on Win2008R2, if I want to get the same output from a registry key that “REG QUERY” would give me, in as readable a format, with the values from a particular registry key, like this:

reg query hkcu\Software\Microsoft\CharMap

HKEY_CURRENT_USER\Software\Microsoft\CharMap
    Advanced    REG_DWORD    0x0
    CodePage    REG_SZ       Unicode
    Font        REG_SZ       Arial

How would I do that with PowerShell? The behaviour of PowerShell mystifies me, once again.

Get-ItemProperty example:

Get-ItemProperty HKCU:\Software\Microsoft\CharMap


PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Microsoft\CharMap
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_CURRENT_USER\Software\Microsoft
PSChildName  : CharMap
PSDrive      : HKCU
PSProvider   : Microsoft.PowerShell.Core\Registry
Advanced     : 0
CodePage     : Unicode
Font         : Arial

In my contrived example above, I want to see “Advanced”, “CodePage” and “Font”, but not any of the PowerShell metadata (names starting in PS). Sadly filtering on the name “PS” would not work for me, because I am not REALLY trying to read the MS Windows Character Map settings, I simply chose them as a registry key that probably everyone with Windows has, so everyone can see how utterly different the experience of using PowerShell is to look at the registry, compared to say the REG.EXE program. There are reasons why anybody might want to get just the registry values from a registry key without getting any of the metadata, and anybody writing tools in PowerShell may want to do this simple task.

I would like output similar to REG QUERY but still in native PowerShell format, not just flattened to text. I’ve googled and searched all over and can’t seem to figure this out.

I’d like to be able to for example do this:

  $all = GetRealRegistryKeysFrom(  HKCU:\Software\Microsoft\CharMap )
  for ($item in $all) { ... }

Update Using the function below, works great….

Example Get-RegistryKeyPropertiesAndValues -path HKCU:\Software\.....

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:10:56+00:00Added an answer on June 14, 2026 at 9:10 pm

    This is a trick:

    Get-ItemProperty HKCU:\Software\Microsoft\CharMap  | out-string -stream | ? { $_ -NOTMATCH '^ps.+' }
    

    The problem is when a property start with PS . Working on this code you can elaborate to exclude these:

    PSPath
    PSParentPath
    PSChildName
    PSDrive
    PSProvider
    

    … One by one inside the where clause. Or just try using

    get-item hkcu\Software\Microsoft\CharMap
    

    There a script that do what you need.

    update reproduced script here:

    Function Get-RegistryKeyPropertiesAndValues
    {
      <#
        Get-RegistryKeyPropertiesAndValues -path 'HKCU:\Volatile Environment'
        Http://www.ScriptingGuys.com/blog
      #>
    
     Param(
    
      [Parameter(Mandatory=$true)]
      [string]$path)
    
     Push-Location
     Set-Location -Path $path
     Get-Item . |
     Select-Object -ExpandProperty property |
     ForEach-Object {
     New-Object psobject -Property @{"property"=$_;
        "Value" = (Get-ItemProperty -Path . -Name $_).$_}}
     Pop-Location
    } #end function Get-RegistryKeyPropertiesAndValues
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My PowerShell script file is located in C:/this-folder/that-folder/another-folder/powershell-file.ps1 . How do I get a
Does PowerShell have an equivalent to this command construct from sh (and derivatives): $
Do PowerShell scripts run under Mono? I would like to run them on a
PowerShell provides a simple technique to view the contents of a function, e.g. Get-Content
Using powershell I want to replace a specific numeric part of a string with
My powershell code actually reads data from an XML and stores the specific data
In PowerShell you can use the Get-WmiObject cmdlet to grab WMI classes. I have
Using powershell how do you create a content sorce that uses a BDC? Documentation
My powershell script takes the following parameter: Param($BackedUpFilePath) The value that is getting passed
A powershell question: I want to extract each line in a character stream produced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.