diff --git a/cmd/zed/os/windows/zed.d/system_boot.ps1 b/cmd/zed/os/windows/zed.d/system_boot.ps1 index 7181ef926109..d70a01b4c59a 100644 --- a/cmd/zed/os/windows/zed.d/system_boot.ps1 +++ b/cmd/zed/os/windows/zed.d/system_boot.ps1 @@ -26,14 +26,11 @@ if (Test-Path $zpoolCachePath) { zed_log_msg LOG_NOTICE "zpool.cache found. Importing ZFS pools" # Import ZFS pools using the zpool command and the cache file - $zpoolImportCommand = "$env:ZPOOL import -c $zpoolCachePath" - - # Execute the command - $result = Invoke-Expression $zpoolImportCommand + & "$env:ZPOOL" import -c "$zpoolCachePath" -a # Optionally, log the result or handle any output - Write-Host "ZFS Pools Imported: $result" + zed_log_msg "ZFS Pools Imported." zed_notify "ZFS Pools Imported" "path" } else { - Write-Host "zpool.cache not found. No pools imported." + zed_log_msg "zpool.cache not found. No pools imported." } diff --git a/cmd/zed/os/windows/zed.d/zed-functions.ps1 b/cmd/zed/os/windows/zed.d/zed-functions.ps1 index d708ea121d6a..92c0034e094e 100644 --- a/cmd/zed/os/windows/zed.d/zed-functions.ps1 +++ b/cmd/zed/os/windows/zed.d/zed-functions.ps1 @@ -128,43 +128,6 @@ function zed_notify_burnttoast() function zed_notify_toast { - param ( - [string]$title, - [string]$message - ) - - # Ensure UWP assemblies are loaded manually - try { - # Attempt to load the necessary UWP notifications assembly - Add-Type -AssemblyName 'Windows.Foundation.UniversalApiContract' - Add-Type -AssemblyName 'Windows.UI.Notifications' - - # Create the toast notification - $toastXml = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent([Windows.UI.Notifications.ToastTemplateType]::ToastGeneric) - - # Set up the XML toast notification content - $toastElements = $toastXml.GetElementsByTagName("binding") - $toastElements.Item(0).SetAttribute("template", "ToastGeneric") - - # Set title and message - $toastXml.SelectSingleNode("//text[@id='1']").InnerText = $title - $toastXml.SelectSingleNode("//text[@id='2']").InnerText = $message - - # Create the toast notification - $toast = New-Object Windows.UI.Notifications.ToastNotification $toastXml - - # Create a ToastNotificationManager - $toastNotifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier("OpenZFS") - - # Show the notification - $toastNotifier.Show($toast) - - } catch { - # If something fails (UWP API issues), log the error and return failure - zed_log_err "Failed to send toast notification: $_" - return 1 - } - # If the toast notification was successfully sent, return success return 0 } diff --git a/cmd/zed/os/windows/zed.d/zed.rc b/cmd/zed/os/windows/zed.d/zed.rc index 95b1071f4e65..6259162a3362 100644 --- a/cmd/zed/os/windows/zed.d/zed.rc +++ b/cmd/zed/os/windows/zed.d/zed.rc @@ -202,11 +202,11 @@ $env:ZED_SYSLOG_SUBCLASS_EXCLUDE="history_event" # Use Toast notification (optional) # If defined, use system Toast notifications # Value is an integer 0 and up. -$env:ZED_TOAST_NOTIFICATIONS = 1 +# $env:ZED_TOAST_NOTIFICATIONS=1 ## # Use BurntToast notification(optional) # If defined, use Burnt Toast notifications # Installed with "Install-Module -Name BurntToast -Force -AllowClobber" # Value is an integer 0 and up. -$env:ZED_BURNTTOAST_NOTIFICATIONS = 1 +# $env:ZED_BURNTTOAST_NOTIFICATIONS=1