Add option names to Fail-Json and Exit-Json

Small fix.
This commit is contained in:
Dag Wieers 2017-08-30 01:25:21 +02:00 committed by GitHub
commit 908a4dc4f7

View file

@ -13,7 +13,7 @@ $ErrorActionPreference = "Stop"
$osversion = [Environment]::OSVersion
$lowest_version = 10
if ($osversion.Version.Major -lt $lowest_version ) {
Fail-Json $result "Sorry, this version of windows, $osversion, does not support Toast notifications. Toast notifications are available from version $lowest_version"
Fail-Json -obj $result -message "Sorry, this version of windows, $osversion, does not support Toast notifications. Toast notifications are available from version $lowest_version"
}
$stopwatch = [system.diagnostics.stopwatch]::startNew()
@ -45,7 +45,7 @@ $result = @{
# and no-one to read the message, so exit but do not fail
# if there are no logged in users to notify.
if ((get-process -name explorer -EA silentlyContinue).Count -gt 0){
if ((Get-Process -Name explorer -ErrorAction SilentlyContinue).Count -gt 0){
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
$template = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastText01)
@ -88,4 +88,4 @@ $stopwatch.Stop()
$result.time_taken = $stopwatch.Elapsed.TotalSeconds
$result.sent_localtime = $endsend_at.Trim()
Exit-Json $result
Exit-Json -obj $result