Created
September 22, 2021 08:46
-
-
Save wgross/dc3e6b92d5ec2c3b37f015a543a38e5a to your computer and use it in GitHub Desktop.
Fetches Key name, property name and property value from registry keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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