Solved

Read the registry with Powershell

Posted on 2014-12-04
6
296 Views
Last Modified: 2014-12-04
Hi,

is there any easy way to read and print (write-host) recourivly all sub-keys and value?

hklm-Software-AnySoftware

->
hklm-Software-Anysoftware-value1 = "hallo"
hklm-Software-Anysoftware-value2 = "another entry"
hklm-Software-Anysoftware-subkey1-value3 = "the3rdvalue"
hklm-Software-Anysoftware-subkey1-value4 = 5
hklm-Software-Anysoftware-subkey1-value5 = "the-last-entry"

something like this...

Thanks in advance

loosain
0
Comment
Question by:loosain
  • 2
  • 2
  • 2
6 Comments
 
LVL 23

Assisted Solution

by:NVIT
NVIT earned 100 total points
ID: 40481559
get-itemproperty -path hklm:\Software\Anysoftware -name value1
get-childitem -path hklm:\Software\Anysoftware -recurse | Format-Table -prop name
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40481615
Great technet article on using powershell with the registry here
0
 

Author Comment

by:loosain
ID: 40481709
get-childitem comes close to that what i want to do.

get-childitem -path hklm:\Software\Anysoftware -recurse | Format-Table -prop name
shows me all the subkeys.

But i want the value store in the subkeys. With the first command (get-itemproperty) i can read them out.
But therfor i have to know which subkeys existing. How have i to pipe those two commands ?

Find out which subkeys existing -> for every subkey find out the value
And this recursively...

Thanks.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 37

Accepted Solution

by:
Neil Russell earned 400 total points
ID: 40481730
Try this out.

$path = "hklm:\Software\Microsoft"
Set-Location -Path $path
$Keys = get-ChildItem -path . -recurse
forEach($Key in $Keys)
  {
  forEach ($Value in $Key.GetValueNames()) {
    New-Object PSObject -Property @{
      Path = $Key.Name
      Name = $Value
      Value = $Key.GetValue($Value)
      Type = $Key.GetValueKind($Value)
    }
  }
}
0
 

Author Closing Comment

by:loosain
ID: 40481842
perfect. This worked.
0
 
LVL 23

Expert Comment

by:NVIT
ID: 40481848
Glad you got it working, loosain.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will show, step by step, how to integrate R code into a R Sweave document
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now