File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,35 @@ function script:OnApplicationExit {
55 $script :ExitCode = 0 # Set the exit code for the Packager
66 }
77
8+ function Test-RegistryValue {
9+ <#
10+ . SYNOPSIS
11+ Check specific values within a key.
12+
13+ . DESCRIPTION
14+ Check specific values within a key, in the same way than Test-Path cmdlet for the key.
15+
16+ . EXAMPLE
17+ Test-RegistryValue -Path 'HKLM:\SOFTWARE\TestSoftware' -Value 'Version'
18+ This will return 'True' or 'False'
19+ #>
20+ param (
21+ [parameter (Mandatory = $true )]
22+ [ValidateNotNullOrEmpty ()]$Path ,
23+ [parameter (Mandatory = $true )]
24+ [ValidateNotNullOrEmpty ()]$Value
25+ )
26+
27+ try {
28+ Get-ItemProperty - Path $Path | Select-Object - ExpandProperty $Value - ErrorAction Stop | Out-Null
29+ return $true
30+ }
31+
32+ catch {
33+ return $false
34+ }
35+ }
36+
837function Set-RegistryKey {
938
1039 [CmdletBinding ()]
You can’t perform that action at this time.
0 commit comments