nssasikumar
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\W indows NT\CurrentVersion\Winlogon \AutoAdmin Logon
HKLM:\System\CurrentContro lSet\Servi ces\Lanman Workstatio n\Paramete rs\Require SecuritySi gnature
HKLM:\Software\Microsoft\W indows\Cur rentVersio n\Policies \System\Di sableCAD
HKLM:\System\CurrentContro lSet\Servi ces\LanMan Server\Par ameters\En ableForced Logoff
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\W
HKLM:\System\CurrentContro
HKLM:\Software\Microsoft\W
HKLM:\System\CurrentContro
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Any particular reason for B grade?
Please see the EE guidelines on grading..
http://support.experts-exchange.com/customer/portal/articles/481419
Please see the EE guidelines on grading..
http://support.experts-exchange.com/customer/portal/articles/481419
ASKER
Just noticed the Grading System, Let me know Is there any possibility of reassign.
ASKER