PoshNotify icon indicating copy to clipboard operation
PoshNotify copied to clipboard

Not working in WIN7

Open asahlali opened this issue 7 years ago • 4 comments

Get-StartApps : The term 'Get-StartApps' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Get-WindowsAppId.ps1:5 char:10

  •     (Get-StartApps -Name 'PowerShell').where({$_.Name -eq 'Window ...
    
  •      ~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (Get-StartApps:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Unable to find type [Windows.UI.Notifications.ToastNotificationManager,Windows.UI.Notifications, ContentType=WindowsRuntime]. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:43 char:13

  • $null = [Windows.UI.Notifications.ToastNotificationManager, Windo ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Windows.UI.Noti...=WindowsRuntime:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.Data.Xml.Dom.XmlDocument,Windows.Data.Xml.Dom.XmlDocument, ContentType=WindowsRuntime]. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:44 char:13

  • $null = [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.X ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Windows.Data.Xm...=WindowsRuntime:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.Data.Xml.Dom.XmlDocument]. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:45 char:17

  • $ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
    
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Windows.Data.Xml.Dom.XmlDocument:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

You cannot call a method on a null-valued expression. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:46 char:5

  • $ToastXml.LoadXml($XmlString)
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

Unable to find type [Windows.UI.Notifications.ToastNotification]. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:47 char:14

  • $Toast = [Windows.UI.Notifications.ToastNotification]::new($Toast ...
    
  •          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Windows.UI.Noti...astNotification:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

Unable to find type [Windows.UI.Notifications.ToastNotificationManager]. At C:\Users\A648920\Documents\WindowsPowerShell\Modules\PoshNotify\0.1.2\Private\Pop-WindowsNotification.ps1:50 char:9

  •     [Windows.UI.Notifications.ToastNotificationManager]::CreateTo ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (Windows.UI.Noti...ficationManager:TypeName) [], RuntimeException
    • FullyQualifiedErrorId : TypeNotFound

asahlali avatar Feb 05 '19 11:02 asahlali

Oh right, we probably should mention that somewhere... this module will only work on Windows 10 (and future releases).

Windos avatar Feb 05 '19 11:02 Windos

We can add some code to the psm1 that checks to make sure those on Windows are at least on Windows 10:

[System.Environment]::OSVersion.Version.Major -ge 10

TylerLeonhardt avatar Feb 17 '19 19:02 TylerLeonhardt

That's how I did it on BurntToast, I'll throw it in

On Mon, 18 Feb 2019, 8:32 AM Tyler James Leonhardt, < [email protected]> wrote:

We can add some code to the psm1 that checks to make sure those on Windows are at least on Windows 10:

[System.Environment]::OSVersion.Version.Major -ge 10

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/Windos/PoshNotify/issues/26#issuecomment-464498664, or mute the thread https://github.com/notifications/unsubscribe-auth/AGojCi8XMO-nVyLqgT9jfX0CEDO1ce_Yks5vOa42gaJpZM4ai_Eu .

Windos avatar Feb 17 '19 19:02 Windos

In my case I use Windows 10 Pro and I get the same problem with [Windows.UI.Notifications.ToastNotificationManager].

Couldn't this be solved by using this way of creating notifications for windows?:

Add-Type -AssemblyName System.Windows.Forms $notif = New-Object System.Windows.Forms.NotifyIcon $notif.Visible = $true

$notif.BalloonTipTitle = "Title" $notif.BalloonTipText = "Some text" $iconPath= (Get-Process -Id $PID).Path

$notif.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($iconPath) $notif.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info

$notif.ShowBalloonTip(0)

ElianFabian avatar Aug 25 '23 00:08 ElianFabian