[Bug]: Basic test script does not work
Steps to Reproduce
I read this article https://www.pdq.com/blog/display-toast-notifications-with-powershell-burnt-toast-module/ and wanted to try out this BurntToast
So I opened PowerShell window as Administrator and executed
Install-Module -Name BurntToast
which resulted with me indulging in these prompt questions
NuGet provider is required to continue PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\YOUR-USER-NAME\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import the NuGet provider now? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): y
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\q\! SCRIPTS>
And yet when I run the basic script example from that article
New-BurntToastNotification -Text 'Yoooo, this is a toast notification... from PowerShell!'
nothing happens
[I am not a programmer, just a small time code tweaker, but I do use some PS1 scripts with great advantage to my modus operandi]
Expected Behavior
No response
Actual Behavior
No response
Experience with Toast
None
Environment data: PowerShell
Name Value
---- -----
PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Environment data: OS
OsName : Microsoft Windows 10 Enterprise
OsVersion : 10.0.19042
OsArchitecture : 64-bit
Environment data: BurntToast
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.8.5 BurntToast {Get-BTHistory, New-BTAction, New-BTAppId, New-BTAudio...}
Consent to Attribution
- [ ] Please shout me out if I've inspired a blog post!
Same here, I haven't seen any articles saying that it no longer works
Same issue
Has anyone got it working?
I wonder if it's to do with this? https://github.com/Windos/BurntToast/issues/233#issue-2162272247
~~Same problem here, for some reason notifications stopped appearing somewhere in the past month or two, and i only now noticed that. I'm using the default PowerShell that came with WIN10 PRO 22H2, so the issue regarding windows store version seems unrelated.~~
~~I'm still seeing notifications from other applications and can even manually pop one from PS:~~
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
$objNotifyIcon.Icon = [System.Drawing.SystemIcons]::Information
$objNotifyIcon.BalloonTipIcon = "Info"
$objNotifyIcon.BalloonTipText = "Test text"
$objNotifyIcon.BalloonTipTitle = "Test title"
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip(10000)
Start-Sleep 500
~~Reinstalling BurntToast didn't help, and both 0.8.5/1.0.0-Preview2 versions aren't working. It's very weird because i don't remember anything that would suddenly cause this. Updates on my system are completely controlled, and i cannot remember doing one in the timeframe where BurntToast broke.~~
~~One of my last scripts that worked was created on 14th of january, so something had to happen recently and i have no clue what changed that could cause this… Any info would be appreaciated.~~
[EDIT]
Well... 1h and one stackoverflow [1][2] post later… My issue was caused by modified PowerShell shortcut located in %APPDATA%\Microsoft\Windows\Start Menu\Programs\Windows PowerShell, apparently changing Target property:
- %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
+ %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoLogo
was what broke BurntToast notifications for me, removing -NoLogo fixed it. So this issue might be related to those two (Windows PowerShell/Windows PowerShell (x86)) shortcuts located in the mentioned Start Menu path.
[EDIT2]
Since it's possible to use a custom AppId by using -AppId parameter then it's possible to make it work with my -NoLogo, and most likely with the Windows Store version of PowerShell that was mentioned in the other issue.
Using this in PS will create a file on desktop with available ID's:
Get-StartApps | Format-List | Out-File -FilePath "$HOME\Desktop\BurntToastAppId.txt"
After that it's just a matter of finding AppID of Windows PowerShell (though any other will also work) and adding it to BurntToast command:
New-BurntToastNotification -Text 'Yoooo, this is a toast notification... from PowerShell!' -AppId 'Microsoft.AutoGenerated.{C9F392EB-B250-4678-1F0C-F0DEEAEDBECC}'
There's also the option of replacing the default one in "C:\Program Files\WindowsPowerShell\Modules\BurntToast\0.8.5\config.json" to avoid setting the parameter with every command.