Solved

Read the registry with Powershell

Posted on 2014-12-04
6
336 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
Set OWA language and time zone in Exchange for individuals, all users or per database.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

914 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

22 Experts available now in Live!

Get 1:1 Help Now