Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toast History access and Toast removal failures on PowerShell 7.1 #136

Open
wi-fr opened this issue Nov 12, 2020 · 3 comments
Open

Toast History access and Toast removal failures on PowerShell 7.1 #136

wi-fr opened this issue Nov 12, 2020 · 3 comments
Assignees
Labels

Comments

@wi-fr
Copy link

wi-fr commented Nov 12, 2020

On PowerShell 7.1 released just now, the Get-BTHistory and Remove-BTNotification functions no longer work.

Steps to reproduce

Get-BTHistory
Remove-BTNotification

Expected behavior

The Get-BTHistory function to return the toast notifications in the Action Center and the Remove-BTNotification function to remove toast notifications from the Action Center

Actual behavior

Both functions fail with the error:
Unable to cast object of type 'WinRT.IInspectable' to type 'Windows.UI.Notifications.ToastNotificationHistory'.
stemming from the “Windows.UI.Notifications.ToastNotificationManager” class that is included in the BurntToast module.

Environment data

[36] ► $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.0
PSEdition                      Core
GitCommitId                    7.1.0
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
[37] ► Get-Module BurntToast -ListAvailable


    Directory: C:\Users\Willi\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     0.8.3                 BurntToast                          Desk      {Get-BTHistory, New-BTAction, New-BTAppId, New-BTAudio…}
Script     0.7.2                 BurntToast                          Desk      {Get-BTHistory, New-BTAction, New-BTAppId, New-BTAudio…}
Script     0.7.1                 BurntToast                          Desk      {Get-BTHistory, New-BTAction, New-BTAppId, New-BTAudio…}
@wi-fr wi-fr added the bug label Nov 12, 2020
@KrX3D
Copy link

KrX3D commented Nov 17, 2020

i get the same problem with PS 7.1 ;)

ToastNotificationManager]::Hist …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to cast object of type 'WinRT.IInspectable' to type 'Windows.UI.Notifications.ToastNotificationHistory'.

@Windos
Copy link
Owner

Windos commented Nov 19, 2020

Thanks for the report, I've got a fix for this (found it in the rush to get a presentation on this module prepped) but forgot to get it rolled out!

Expect the fix in the next update

@IanBAdams
Copy link

IanBAdams commented Nov 23, 2020

I had installed PowerShell 7.1 from the Microsoft Store a couple of weeks back. When I ran New-BurntToastNotification nothing happened, no errors, no warnings and no notifications. Get-Command -Module BurntToast output listed the various BurntToast commands as you would expect,

Uninstalled PowerShell 7.1 and then re-installed using Invoke-Expression "& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) } -UseMSI" and tried New-BurntToastNotification again. This time it worked OK so I guess either something was wrong with my Microsoft Store installed version of PowerShell or something is different between the installs from the Microsoft Store and the Invoke-Expression method.

Got the same behavior as noted above with Get-BTHistory and Remove-BTNotification (i.e. Unable to cast object error) with both the Microsoft Store and Invoke-Expression methods.

Just passing this on in case anyone else raises issues with running BurntToast against PowerShell 7.1 installed from the Microsoft Store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants