-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-Notepadpp.ps1
83 lines (77 loc) · 2.19 KB
/
Get-Notepadpp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<#
.Synopsis
Short description
This script will be used for validating the installed Notepad++ in the target system.
.DESCRIPTION
Long description
2021-02-06 Sukri Created.
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
.INPUTS
Inputs to this cmdlet (if any)
.OUTPUTS
Output from this cmdlet (if any)
.NOTES
General notes
Author : Sukri Kadir
Email : [email protected]
.COMPONENT
The component this cmdlet belongs to
.ROLE
The role this cmdlet belongs to
.FUNCTIONALITY
The functionality that best describes this cmdlet
#>
function Get-Notepadpp
{
Param
(
#Parameter for registry path for installed software..
[ValidateNotNullOrEmpty()]
[Array]
$UninstallRegistries = @("HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall", "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
)
Begin
{
#throw exception if registry path is not available.
foreach ($UninstallRegistry in $UninstallRegistries)
{
#write warning if only not exist.
if (!$( Test-Path -Path $UninstallRegistry -PathType Any ))
{
Write-Warning -Message "[$UninstallRegistry] does not exist." -WarningAction Continue
}
}
}
Process
{
#recusively search Notepad++ through registry key.
foreach ($UninstallRegistry in $UninstallRegistries)
{
#get Notepad++ registry properties.
$RegistryProperties = Get-ItemProperty -Path "$UninstallRegistry\*"
foreach ($RegistryProperty in $RegistryProperties)
{
if ($( $RegistryProperty.DisplayName ) -like "*Notepad++*")
{
$ApplicationName = $( $RegistryProperty.DisplayName )
}
}
}
}
End
{
#return true if Notepad++ installed in target system.
if ($ApplicationName)
{
return $true, $ApplicationName
}
#return false if no Notepad++ installed in target system.
if (!$ApplicationName)
{
return $false
}
}
}