Validate Registry Entry and Return the Values if available using Powershell

I have to Validate Registry Value entry and need if entry is there, need to return the Registry Value Data.
So i have made an external Text file with Registry Path to be Validated.
Following is the Code to verify the Registry entry availability, but it does not work as expected.

Need Assistance in Validating and if Return the Value Data if Registry entry is available.

function get
$RQ = Get-Content C:\Testing\PS\Reg.txt
foreach($RD in $RQ)
if(!(Test-Path -Path $rd))
Write-Host "RegValue Not Exists!"
Write-Host "RegValue Exists!"

Txt File having the registry path to validate:
HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subash SundharanIT Infrastructure Architect Commented:
Try this..

function get ($file) {
Get-Content $file | % {
$RD = $_
$Name = ($RD -split "\\")[-1]
$Key = $RD -replace "\\$Name$"
	$Value = Get-ItemProperty -Path $Key -Name $Name -EA STOP | Select-Object -ExpandProperty $Name
	$Value | Select @{N="Key";E={$RD}},@{N="RegValue";E={$_}}
	"" | Select @{N="Key";E={$RD}},@{N="RegValue";E={"Not Exists!"}}
get C:\Testing\PS\Reg.txt | FT -AutoSize

Open in new window

Ref :

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nssasikumarAuthor Commented:
Subash SundharanIT Infrastructure Architect Commented:
Any particular reason for B grade?

Please see the EE guidelines on grading..
nssasikumarAuthor Commented:
Just noticed the Grading System, Let me know Is there any possibility of reassign.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.