Skip to content

Instantly share code, notes, and snippets.

@Sh1n0g1
Created March 23, 2017 02:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sh1n0g1/a2e4a4580251fca469ea7dd697e1944e to your computer and use it in GitHub Desktop.
Save Sh1n0g1/a2e4a4580251fca469ea7dd697e1944e to your computer and use it in GitHub Desktop.
Test-RegistryName
<#
.EXAMPLE
Test-RegistryName -Path "HKCU:\Software\Sysinternals\Strings" -Name "EulaAccepted"
#>
function Test-RegistryName {
param (
[parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Path,
[parameter(Mandatory=$true)][ValidateNotNullOrEmpty()]$Name
)
If (Test-Path $Path){
if(Get-ItemProperty -Path $Path){
Try {
Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null
return $true
}Catch {
return $false
}
}else{
return $false
}
}else{
return $false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment