-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathGet-AppEventSound.ps1
53 lines (46 loc) · 1.83 KB
/
Get-AppEventSound.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
function Get-AppEventSound {
<#
.SYNOPSIS
Determines the sounds that are configured to play after certain events are triggered
.DESCRIPTION
Determines the sounds that are configured to play after certain events are triggered
.PARAMETER Name
A string that will perform -like search of keys found in the Registry
.EXAMPLE
Get-AppEventSound -Name "Notification.Looping.Alarm" -Verbose
VERBOSE: Starting [Get-AppEventsSound]
VERBOSE: Searching for AppEvents matching [Notification.Looping.Alarm]
VERBOSE: Ending [Get-AppEventsSound]
AppEvent UnExpanded Expanded
-------- ---------- --------
Notification.Looping.Alarm %SystemRoot%\media\Alarm01.wav C:\WINDOWS\media\Alarm01.wav
#>
[CmdletBinding(ConfirmImpact = 'Low')]
param (
[string] $Name = '*'
)
begin {
Write-Verbose -Message "Starting [$($MyInvocation.Mycommand)]"
Write-Verbose -Message "Searching for AppEvents matching [$Name]"
$Path = 'HKCU:\AppEvents\Schemes\Apps\.Default\*\.Current'
}
process {
$Key = Get-ChildItem -Path $Path
$Key | ForEach-Object {
$Item = $_
$AppEvent = Split-Path -Path $Item.PsParentPath -Leaf
if ($AppEvent -like $Name) {
$Expanded = $Item.GetValue($null, $null)
$UnExpanded = $Item.GetValue($null, $null, [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)
New-Object -TypeName psobject -Property ([ordered] @{
AppEvent = $AppEvent
UnExpanded = $UnExpanded
Expanded = $Expanded
})
}
}
}
end {
Write-Verbose -Message "Ending [$($MyInvocation.Mycommand)]"
}
}