Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is an example in PowerShell to verify a registry value:

if((Get-ItemProperty -Path 'HKLM:\Software\Company\Product' -Name 'Version').Version -eq '1.0.0.0') {
    Write-Host 'The registry value is correct.'
} else {
    Write-Host 'The registry value is incorrect.'
}

This code checks whether the Version value in the HKLM:\Software\Company\Product registry key is equal to "1.0.0.0". If it is, the If statement executes the true branch of the condition (outputs a message saying the registry value is correct). If not, the false branch executes (outputs a message saying the registry value is incorrect).