Forum Discussion
Paige__Tanner
Mar 11, 2024Brass Contributor
Clear notifications
Hello! Is it possible to clear the current Windows notifications from PowerShell? By notifications I mean the ones shown by the bell in the rightmost point of the taskbar. I don't want to avoid rec...
- Mar 12, 2024Yes, because the RunTime isn't included in PowerShell 7.4. I'm afraid we can't fix that since the support for WinRT has been removed after just a few versions of PowerShell 7.
Paige__Tanner
Mar 11, 2024Brass Contributor
Harm_Veenstra Thanks for having tried. This doesn't work for me. Running the same script, I get many errors equal to this one:
InvalidOperation: C:\test_script.ps1:10
Line |
10 | ([Windows.UI.Notifications.ToastNotificationManager]::History).cl …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unable to find type [Windows.UI.Notifications.ToastNotificationManager].which are probably related to the error mentioned in my first post. I wonder why my system does not have [Windows.UI.Notifications.ToastNotificationManager].
Mar 11, 2024
Seems to be something with the built-in WinRT support that has been removed in PS7?
- Paige__TannerMar 11, 2024Brass Contributor
It could be something similar, yes. Some missing module or framework? But what exactly?
I can only add that I tried your script also on Windows PowerShell 5.1 and in my case it gives error as well:
Unable to find type [Windows.UI.Notifications.ToastNotificationManager]. At C:\test_script.ps1:10 char:6 + ([Windows.UI.Notifications.ToastNotificationManager]::History).cl ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (Windows.UI.Noti...ficationManager:TypeName) [], RuntimeException + FullyQualifiedErrorId : TypeNotFound- Mar 11, 2024Do you have the Microsoft Windows Desktop Runtime installed?
- Paige__TannerMar 12, 2024Brass ContributorI didn't. Now I just installed it and the script works with Windows PowerShell 5.1, but not in PowerShell 7.4. It's better than before, but there is still something missing.