Skip to content

Instantly share code, notes, and snippets.

@easternnl
Created October 1, 2019 05:43
Show Gist options
  • Save easternnl/e06a1e6c2f5961f5373eff71cdc95769 to your computer and use it in GitHub Desktop.
Save easternnl/e06a1e6c2f5961f5373eff71cdc95769 to your computer and use it in GitHub Desktop.
EasternRegQuery.ps1
function Get-RegValue([String] $KeyPath, [String] $ValueName) {
(Get-ItemProperty -LiteralPath $KeyPath -Name $ValueName).$ValueName
}
$regpath = $args[0]
$regs = @()
foreach ($property in (Get-Item $regpath).property)
{
$reg = new-object PSObject
$reg | add-member -type NoteProperty -Name Key -Value $property
$reg | add-member -type NoteProperty -Name Value -Value (Get-RegValue -KeyPath $regpath -ValueName $property)
$regs += $reg
}
$regs | sort -Property key | out-gridview -wait -title "Registry: $($args[0])"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment