1

I'm trying to create a powershell command that will return the value of specific keys in the registry. The name of the keys are "Name" "Data" and "Percentage"

What I have below grabs all the subkeys, but I can't figure out how to just select the names of the keys above and have them outputted to me? It seems like it would be easy, but I can't figure out how to have multiple results in one query. Any help would be appreciated!

Get-ChildItem hklm:\SOFTWARE\Wow6432Node\Software\Softwarename | ForEach-Object {Get-ItemProperty $_.pspath}

2 Answers 2

2

Try using '\*' with Get-ItemProperty cmdlet.for example

Get-ItemProperty hklm:\SOFTWARE\Wow6432Node\*
Sign up to request clarification or add additional context in comments.

Comments

0

Try:

Get-ChildItem hklm:\SOFTWARE\Wow6432Node\Software\Softwarename | Where-Object {$_.Name -eq "Data" -or $_.Name -eq "Name" -or $_.Name -eq "Percentage" } | ForEach-Object { Get-ItemProperty $_.pspath }

2 Comments

I get an error message saying "Get-ItemProperty : Cannot bind argument to parameter 'Path' because it is null." If I switch things around to this: Get-ChildItem hklm:\SOFTWARE\Wow6432Node\Software\Softwarename ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {$_.Name -eq "Data" -or $_.Name -eq "Name" -or $_.Name -eq "Percentage" } I don't get an error message but nothing shows up
Try now, if it doesn't work then try without selecting property first

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.