Link to home
Start Free TrialLog in
Avatar of nssasikumar
nssasikumarFlag for India

asked on

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.

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

Txt File having the registry path to validate:
-------------------------------------------------------
HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
HKLM:\System\CurrentControlSet\Services\LanmanWorkstation\Parameters\RequireSecuritySignature
HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableCAD
HKLM:\System\CurrentControlSet\Services\LanManServer\Parameters\EnableForcedLogoff
ASKER CERTIFIED SOLUTION
Avatar of SubSun
SubSun
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nssasikumar

ASKER

Works
Any particular reason for B grade?

Please see the EE guidelines on grading..
http://support.experts-exchange.com/customer/portal/articles/481419
Just noticed the Grading System, Let me know Is there any possibility of reassign.