Skip to content

Instantly share code, notes, and snippets.

@wgross
Created September 22, 2021 08:46
Show Gist options
  • Save wgross/dc3e6b92d5ec2c3b37f015a543a38e5a to your computer and use it in GitHub Desktop.
Save wgross/dc3e6b92d5ec2c3b37f015a543a38e5a to your computer and use it in GitHub Desktop.
Fetches Key name, property name and property value from registry keys
Get-ChildItem . | Foreach-Object {
# this is done foreach reg key
$regKey = $_;
# property is a list of properties of the registry key
$_.Property | ForEach-Object -Process {
[PScustomobject]@{
Key =$regKey.Name
Property=$_
# Value is returned as a complex object extsnded with sevaral PS properties.
# Repeasting the actual property name here projects to the value alone
Value= ($regKey | Get-ItemProperty -Name $_).$_
}
}
} | ConvertTo-Json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment