Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Read the registry with Powershell

Posted on 2014-12-04
6
Medium Priority
?
381 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 25

Assisted Solution

by:NVIT
NVIT earned 400 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 37

Accepted Solution

by:
Neil Russell earned 1600 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 25

Expert Comment

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

Featured Post

Introducing the WatchGuard 420 Access Point

WatchGuard's newest access point includes an 802.11ac Wave 2 chipset, providing the fastest speeds for VoIP, video and music streaming, and large data file transfers. Additionally, enjoy the benefits of strong security as the 3rd radio delivers dedicated WIPS protection!

Question has a verified solution.

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

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

719 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