-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetNovaUpdateNotificationPreferenceStatus.ps1
More file actions
46 lines (37 loc) · 1.6 KB
/
Copy pathGetNovaUpdateNotificationPreferenceStatus.ps1
File metadata and controls
46 lines (37 loc) · 1.6 KB
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
function Get-NovaUpdateNotificationPreferenceStatus {
[CmdletBinding()]
param()
$preference = Read-NovaUpdateNotificationPreference
$settingsPath = Get-NovaUpdateSettingsFilePath
$settingsFileExists = Test-Path -LiteralPath $settingsPath -PathType Leaf
$status = [pscustomobject]@{
PrereleaseNotificationsEnabled = $preference.PrereleaseNotificationsEnabled
StableReleaseNotificationsEnabled = $true
SettingsPath = $settingsPath
}
Write-NovaUpdateNotificationPreferenceStatusVerbose -Status $status -SettingsFileExists:$settingsFileExists
return $status
}
function Write-NovaUpdateNotificationPreferenceStatusVerbose {
[CmdletBinding()]
param(
[Parameter(Mandatory)][pscustomobject]$Status,
[Parameter(Mandatory)][bool]$SettingsFileExists
)
$prereleaseState = Get-NovaUpdateNotificationPreferenceStateText -Enabled:$Status.PrereleaseNotificationsEnabled
if ($SettingsFileExists) {
Write-Verbose "Prerelease self-updates are $prereleaseState. Stable self-updates remain available. Settings file: $( $Status.SettingsPath )"
return
}
Write-Verbose "No settings file was found at $( $Status.SettingsPath ). Using the default setting: prerelease self-updates are $prereleaseState. Stable self-updates remain available. Use Set-NovaUpdateNotificationPreference to store a different preference."
}
function Get-NovaUpdateNotificationPreferenceStateText {
[CmdletBinding()]
param(
[Parameter(Mandatory)][bool]$Enabled
)
if ($Enabled) {
return 'enabled'
}
return 'disabled'
}