Solved

Read the registry with Powershell

Posted on 2014-12-04
6
377 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 24

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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 24

Expert Comment

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

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

In this previous article (https://oddytee.wordpress.com/2016/05/05/provision-new-office-365-user-and-mailbox-from-exchange-hybrid-via-powershell/), we made basic license assignments to users in O365. When I say basic, the method is the simplest way …
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

773 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