Git Product home page Git Product logo

toast-notification-script's People

Contributors

imabdk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toast-notification-script's Issues

Buttons disappear if PendingRebootUptimeText=True

If using the PendingRebootUptimeText=True option the extra text causes the buttons to disappear.

With PendingRebootUptimeText=False
ToastReboot1

With PendingRebootUptimeText=True
ToastReboot2

The issue can be resolved by changeing the code on row 1910 from:

if (($PendingRebootUptimeTextEnabled -eq "True") -AND ($Uptime -gt $MaxUptimeDays)) {
$UptimeGroup = @"
        <group>
            <subgroup>     
                <text hint-style="body" hint-wrap="true" >$PendingRebootUptimeTextValue</text>
            </subgroup>
        </group>
        <group>
            <subgroup>
                <text hint-style="base" hint-align="left">$ComputerUptimeText $Uptime $ComputerUptimeDaysText</text>
            </subgroup>
        </group>
"@
    $Toast.toast.visual.binding.InnerXml = $Toast.toast.visual.binding.InnerXml + $UptimeGroup
}

to:

if (($PendingRebootUptimeTextEnabled -eq "True") -AND ($Uptime -gt $MaxUptimeDays)) {
$UptimeGroup = @"
        <group>
            <subgroup>     
                <text hint-style="body" hint-wrap="true" >$PendingRebootUptimeTextValue</text>
                <text hint-style="body" hint-wrap="true" ></text>
                <text hint-style="base" hint-align="left">$ComputerUptimeText $Uptime $ComputerUptimeDaysText</text>
            </subgroup>
        </group>
"@
    $Toast.toast.visual.binding.InnerXml = $Toast.toast.visual.binding.InnerXml + $UptimeGroup
}

This will give the same visual apperance of the text and allow the buttons to be displayed. I do not know why this happens, I havn't found any documented limits to the number of groups within an XML but I am suspecting that might be the issue.

I have tested on Windows 10 1909 and 2004 and replicated the issue on both.

Run as non-admin?

Good afternoon,

First, thank you for the excellent toast tool.

I am at an impasse, I would like to use this script with users that are not administrators on their devices. I am using SCCM/MECM and following the directions to run it within the user context. It works when the user is admin, but otherwise not.

Does anyone have a work around for this?

Any help is much appreciated.

Thank you.

Custom "ToastRunApplicationID:" protocol not doing anything when application InstallState is "NotUpdated"

While debugging why the custom "ToastRunApplicationID:" protocol wasn't doing what it was supposed to do I checked the InstallState of the application I was trying to install and found that it was "NotUpdated", rather than "Installed" or "NotInstalled", which is what the script is checking for.

Was running the following configuration:

	<Option Name="RunApplicationID" Enabled="True" Value="ScopeId_968C5854-F7DB-48D1-B4AA-C4DCEAE28031/Application_fc16cc10-b644-4559-96bd-432ba32d36fe" />
	<Option Name="DynamicDeadline" Enabled="True" Value="ScopeId_968C5854-F7DB-48D1-B4AA-C4DCEAE28031/Application_fc16cc10-b644-4559-96bd-432ba32d36fe" />
	<Option Name="ActionButton1" Enabled="True" />
	<Option Name="Action1" Value="ToastRunApplicationID:" />

I've submitted a pull request @ #15 (sorry for the additional line-ending edits. Github's webinterface forced those on me. Feel free to ignore those.) The truly important edit is in line 1093.

Feature - Announcements / Question

Feature - Announcements
I really like your toast script and I was wondering if there was a way to add just plain notifications. I'd like to be able to have the script check a URL for the xml for a general announcement. I'd also want to make sure users aren't shown the announcement more than once each time the xml is updated.

Question
I see you're writing data to the HKCU registry and to the log. Doesn't that bloat the registry and log after a while or is there some cleanup done to those items so they don't get bloated over time. Ideally a rolling log and registry entries would be great!

Thanks again for writing this! It's amazing!

Reboot button action do not install updates pending reboot. Think I found a solution that works for me.

shutdown.exe /r /t 0 /d p:0:0 /c "Toast Notification Reboot"
Do not install updates pending reboot, it just restarts a computer (and some times may "finish" installing updates if no other actions required)

But if we need to "Update and Restart" this line worked for me:
[String]$Script = 'USOClient.exe RestartDevice ResumeUpdate && shutdown.exe /r /t 0 /d p:2:3 /c "Toast Notification Reboot"'

'USOClient.exe RestartDevice ResumeUpdate`
Do not execute a restart as they did before, as I think they put some "flags" that update orchestrator needs to make some actions.

and p:2:3 is just the way I use it, I don't think it has any impact (not tested with p:0:0)

Log Action in log file

Hello, thkxs for the work.

Could you tell me how can i log in the logfile which action is the user doing (wich button is pressed)?

Thxs

Unable to configure parameters for protocol InvokePSScriptAsUser

Hi,

First off, sorry because I feel I'm asking a dumb question. I've been digging into the documentation, the issues and the script itself and still I'm unable to understand how to setup a config file to call a custom PoSH script.

The environment is running the Toast as SYSTEM and the embedded functions show the Toast Notification to the logged in user.
Action buttons work as usual when calling a web page or an SCCM Task Sequence.

However if I set the Action Button value to "InvokePSScriptAsUser:" and I click on it, it asks for an app to be opened in Windows Store.

As I guess something was missing, I've read the Doc and also searched on Github issues but there is nothing where it states how to call a custom powershell. So I'm a bit lost on how to pass the script name and any parameters for the script itself.

Am I trying to do something the script is not ready for?

Start an EXE on local machine

Looking to have the action button that will start my VPN client on the local machine. I am able to start TXT and LOGs but not an EXE? Any ideas? This is through the XML

Images not loaded when on share

Hello,

I am executing a batch file from a share:
\\fs02.lan.somedomain.nl\deploy$\Scripts\Toast\RunToastHidden-Reboot-Computer.cmd

The contents of the batch file is:

@ ECHO OFF

PUSHD %~dp0

if exist "New-ToastNotification.ps1" (
powershell.exe -file "New-ToastNotification.ps1" -Config "config-toast-rebootpending.xml"
)

:END
POPD

The notification is being displayed without the images.

Need a solution to limit the number of times snooze can be used.

I have a problem statement where I want the user to get the toast notification and I want to give the user the option to Snooze or Restart the PC. If the user snoozes the toast notification, it should snooze, but I do not want the user to have the power to click on Snooze infinitely and so I want to limit the number of times user can click on Snooze to 3 and post that the user gets only the Restart button.

The pending reboot doesn't work ok on new W10 builds with new shutdown menu.

From W10 build 20H2 and newer that have the new shutdown menu, the following registry key is removed if you click on Restart without updating. So you still have reboot pending, but the registry key is removed.

$WURebootKey = Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" 

The new key to be checked on these newer W10 builds is:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsUpdate\UX\StateVariables  
    RebootRequired 

The RebootRequired should have value 1. If it has value 0 or is missing, then reboot is not pending.

image

Get-GivenName using WMI returns the last name when using 'Last, First' formatting

My organization uses 'Last, First' for our display names, so when the Get-GivenName function runs and has to retrieve the information from WMI the last name is returned instead of the first name. The specific command is on line 262:

$GivenName = $DisplayName.Split()[0].Trim()

I can easily remedy that by changing the split to 1:

$GivenName = $DisplayName.Split()[1].Trim()

Not sure if you want to document this somewhere, or find a way to account for differences in formatting between organizations.

Pending reboot detection

I was playing around with the 2.3.0 version of the script and trying out the PendingReboot detection .. only to notice that my computer was waiting for a reboot despite not having installed any updates recently.

A little investigation showed me the reason for that in the "Test-PendingRebootRegistry" function:

$CBSRebootKey = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending" -ErrorAction Ignore
$WURebootKey = Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -ErrorAction Ignore
$FileRebootKey = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" -Name PendingFileRenameOperations -ErrorAction Ignore
if (($CBSRebootKey -ne $null) -OR ($WURebootKey -ne $null) -OR ($FileRebootKey -ne $null)) {
Write-Log -Message "Check returned TRUE on ANY of the registry checks: Reboot is pending!"
$true
}

In this case it wasn't $CBSRebootKey or $WURebootKey that posed the problem, but $FileRebootKey. Checking the registry key showed that it was full with entries from our Endpoint Protection.

Alerting the users because of this, practically every day if not multiple times a day, is not something we want to do. It would severely decrease the willingness to restart the machines for actualy security updates that are waiting for a reboot.

For now I've fixed the "issue" by simply modifying the script like this:

$FileRebootKey = $null

In the long run it would be great if the PendingReboot detection triggers would be configurable in the config.xml file.

Add options

Please add options to the configuration that sets the Tag, Group and ExpiresOnReboot properties of the ToastNotification. This will allow me to avoid spamming the users.

If i use the same tag and group in the notifications it will not show a new one if there is one active in the action center. Also ExpiresOnReboot should clear the notifications when a reboot happens.

Thank you for this script, it helps alot!

Don´t Display Notification when Deployment is not present

Hello,

can you add an option to the xml files that the Notification is not displayed when the PackageID is not deployed to the device?

I have test this an i see the notification but the deployment is not deployed. I read in the log: Appears that the specified package ID: XX123456 is not deployed to the device.

The benefit is we can deploy the Toast-Notification-Script Toolkit with his configuration and when the package is deployed then the notification is displayed.

Thank you

Best regards Pimpi

Problem with how WPN handles settings

New-ItemProperty -Path $RegPath\$App -Name "Enabled" -Value 1 -PropertyType "DWORD" -Force

If a user clicks the cogwheel in a notification and disables notifications from an application it will be disabled. The line above does not activate the notification in this case. The registry is "second hand information" in this case. Windows Push Notification service works with a sqlite database located in C:\Users\USERNAME\AppData\Local\Microsoft\Windows\Notifications\wpndatabase.db and reads the value from that database if it is present.

Here is a SQL to read the value which should be equal to HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SoftwareCenter.DesktopToasts\Enabled
SELECT hs.* FROM HandlerSettings hs INNER JOIN NotificationHandler nh ON nh.RecordId = hs.HandlerId WHERE nh.PrimaryId = 'Microsoft.SoftwareCenter.DesktopToasts' and hs.SettingKey ='s:toast'

As long as s:toast has a value of 0 this function will return as if the notification was shown but nothing has been displayed:

[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($App).Show($ToastXml)

If this script would use the powershell module PSSQLite or include its own functions to manipulate the sqlite-database it would be possible to force the display of notifications AND verify that the notification has been displayed.

User can disable notifications for specific sender

It is possible to disable the notifications for Softwarecenter or Powershell using the sender notification settings or "Turn off all notifications setting" of the Notification Center. You can see the registry keys beeing reset after the next run of the Toast-Notification-Script, but this does not affect the visibility of the notifications. No reboot or service restart can fix this issue. The only way to turn the notifications back on is by using the On/Off Switch in the sender notification settings.

Evaluate environment variables in XML

I would have really liked to include e.g. $env:ComputerName in some of the texts configured in the XML but it seems like that does not work.

Any chance to get that implemented?

It is loosely related to the issue reported in #12 where the user gets confused where his Software Center window went - behind the fullscreen RDP window. For such a case I wanted to include $env:ComputerName in one of the texts (AttributionText, HeaderText, TitleText, BodyText1, BodyText2) so the user knows which computer the toast actually appeared on.

ExpiresOnReboot

Can we add ExpiresOnReboot = $true for some of the scenarios ?

bug if running RunToastHidden.cmd on 64bit OS from 32bit context

If you are running the script on 64bit OS from 32bit context, like a SCCM program, the script will not see the 64bit registries.
The solution is to check the context on which the script runs, like this:

REM This file is intended to be used when the toast notification script is used with scheduled tasks with the Hidden.vbs file. See the documentation for further details

IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" (
SET pspath="C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe"
) ELSE (
SET pspath="C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
)
%pspath% -file "C:\ProgramData\ToastNotificationScript\PendingReboot\New-ToastNotification.ps1" -Config "\\YourNetworkPath\ToastNotificationScript\Configs\config-toast-pendingreboot.xml"

Windows 11 22H2 - Toasts not displayed

Has anyone successfully got toasts running on Windows 11 22H2? The script will run fine and returns toast is displayed but nothing pops on machine. Previous Win11 21H1 version they run OK.

Thought it was Focus settings, but no.

Checked the WMI queries around Windows versions, and they all still pass fine for 22H2.

Doing some more digging, will report back if i find a resolution.

reboot MSI package missing from ZIP

The file is missing. I was wondering if it would be possible just to call restart-computer -force instead of jumping through hoops and installing a .cmd file using an archaic command that has a more sufficient replacement however? Can this be done and if so what would I need to drop in either the config or the powershell script? I was thinking of editing the function in the script but I am not sure that will be sufficient.

Notification for win10 upgrade scenario displays "Dismiss" button even when disabled in the XML

Hi,

I've noticed that the 2.0.2 is displaying a Dismiss button even though it is disabled in the XML.
I checked the log file and there I also see the line : Creating the xml for no dismiss button.

I changed it around and removed the snooze button, keeping only the action + dismiss button. that works.

So it's reading the XML and interpreting the config, yet it's still displaying the button.

2020-10-05 14:02:08 INFO: Creating the xml for no dismiss button 2020-10-05 14:02:08 INFO: Creating the xml for snooze button 2020-10-05 14:02:08 INFO: Toast notification is used in regards to OS upgrade. Taking running OS build into account 2020-10-05 14:02:08 INFO: All good. Toast notification was displayed

the config.xml file without language part:
<?xml version="1.0" encoding="utf-8"?> <Configuration> <Feature Name="Toast" Enabled="True" /> <!-- Enables or disables the entire toast notification --> <Feature Name="UpgradeOS" Enabled="True" /> <!-- Specifies if the toast is used for OS upgrades. If set to True, the targetOS build is taking into account --> <Feature Name="PendingRebootUptime" Enabled="False" /> <!-- Enables the toast for reminding users of restarting their device if it exceeds the uptime defined in MaxUptimeDays --> <Feature Name="PendingRebootCheck" Enabled="False" /> <!-- Enables the toast for reminding users of pending reboots found in registry/WMI. Might not suit ConfigMgr all too well, as if a pending reboot is found, further deployments won't run --> <Feature Name="ADPasswordExpiration" Enabled="False" /> <!-- Enables the toast for reminding users of expiring Active Directory passwords --> <Option Name="TargetOS" Build="18363" /> <!-- The actual build number of the targeted OS. 19041 = 2004 | 18363 = 1909 | 18362 = 1903 | 17763 = 1809. This option has no effect if OSUpgrade is set to False --> <Option Name="MaxUptimeDays" Value="-6" /> <!-- When using the toast for checking for pending reboots. A reboot is considered pending if computer uptime exceeds the value set here --> <Option Name="PendingRebootUptimeText" Enabled="False" /> <!-- Adds an additional group to the toast with text about the uptime of the computer --> <Option Name="PendingRebootCheckText" Enabled="False" /> <!-- Adds an additional group to the toast with text --> <Option Name="ADPasswordExpirationText" Enabled="False" /> <!-- Adds an additional group to the toast with text --> <Option Name="ADPasswordExpirationDays" Value="90" /> <!-- How many days in advance shall the toast start reminding the users --> <Option Name="RunPackageID" Enabled="false" Value="" /> <!-- Will enable the toast to run any ConfigMgr PackageID through a custom protocol --> <Option Name="RunApplicationID" Enabled="False" Value="ScopeId_A9117680-D054-482B-BC97-532E6CBD0E6B/Application_fd55f35c-4e34-4490-a3ec-ee0b79233ec6" /> <!-- Will enable the toast to run any ConfigMgr ApplicationID through a custom protocol --> <Option Name="RunUpdateID" Enabled="False" Value="4561600" /> <!-- Will enable the toast to run any ConfigMgr Update ID through a custom protocol. Configure the value to the relevant KB-article ID --> <Option Name="RunUpdateTitle" Enabled="False" Value="" /> <!-- Will enable the toast to run any ConfigMgr Update Name through a custom protocol --> <Option Name="Deadline" Enabled="False" Value="30-09-2019 08:00" /> <!-- Adds an additional group to the toast with text about the deadline of the OSUpgrade --> <Option Name="DynamicDeadline" Enabled="False" Value="" /> <!-- Adds an additional group to the toast with text about the deadline of the OSUpgrade. This will retrieve the deadline of the IPU from WMI --> <Option Name="CreateScriptsAndProtocols" Enabled="True" /> <!-- Automatically create the needed custom scripts and protocols. This removes the need to do scripts and protocols outside of the script --> <Option Name="UseSoftwareCenterApp" Enabled="True" /> <!-- The app in Windows doing the actual notification - can't be both SoftwareCenter and Powershell --> <Option Name="UsePowershellApp" Enabled="False" /> <!-- The app in Windows doing the actual notification - can't be both SoftwareCenter and Powershell --> <Option Name="CustomAudio" Enabled="False" /> <!-- Enable or disable a custom speak scenario, where the text will be read out aloud --> <Option Name="LogoImageName" Value="ToastLogoImageTSI.jpg" /> <!-- File name of the image shown as logo in the toast notoification --> <Option Name="HeroImageName" Value="ToastHeroImageWaas.jpg" /> <!-- File name of the image shown in the top of the toast notification --> <Option Name="ActionButton" Enabled="True" /> <!-- Enables or disables the action button. --> <Option Name="DismissButton" Enabled="False" /> <!-- Enables or disables the dismiss button. --> <Option Name="SnoozeButton" Enabled="True" /> <!-- Enabling this option will always enable action button and dismiss button --> <Option Name="Scenario" Type="reminder" /> <!-- Possible values are: reminder | short | long --> <Option Name="Action" Value="softwarecenter:Page=OSD" /> <!-- Action taken when using the Action button. Can be any protocol in Windows --> <Text Option="GreetGivenName" Enabled="True" /> <!-- Displays the toast with a personal greeting using the users given name retrieved from AD. Will try retrieval from WMI of no local AD --> <Text Option="MultiLanguageSupport" Enabled="False" /> <!-- Enable support for multiple languages. If set to True, the toast notification will look for the users language culture within the config file --> <en-US>

Don´t Display Notification when Deployment is already installed

Would it be possible to introduce an option that would let me not display a notification if the specified deployment is already installed?

I've set the following option in the XML:

<Option Name="RunApplicationID" Enabled="True" Value="ScopeId_968C5854-F7DB-48D1-B4AA-C4DCEAE28031/Application_6cee0155-d552-4067-9990-1946456585d5" />

But regardless of install state I get the notification.

In #2 a similar feature was already introduced to not show notifications for deployments that aren't available on the client.

Reason for the request: I'd love to use the script to advertise a software update. But I don't want the users to still receive the notifications when the update has already been installed. I'm well aware that this can also be achieve in other ways (compliance rules, dynamic collections, ...) but I'd like to keep the deployments as simple as possible.
An additional option in the XML that enables a check whether the deployment was already installed would be much appreciated and make my work a lot easier.

Feature request "vanilla config"

I don’t know how to summarize this feature shortly, so I'll try to describe it the way I see it.

What I was thinking when I saw the full config used to run only one feature: is it possible to store all config options in a false state as "vanilla config" and pass to the script a config with specific feature (pass check, reboot etc.) configuration options?

For example:
vanilla_config.xml

<Feature Name="Toast" Enabled="false" />
<Feature Name="PendingRebootUptime" Enabled="False" />
<Feature Name="PendingRebootCheck" Enabled="False" />
<Feature Name="UpgradeOS" Enabled="False" />
<Option Name="Scenario" Type="reminder" />
<Option ..... Enabled="False">
....
<en-US>
...
</en-US>
....

PendingRebootUptime.xml

<Feature Name="Toast" Enabled="true" />
<Feature Name="PendingRebootUptime" Enabled="True" />
<Option Name="PendingRebootUptimeText" Enabled="True" />
<Option Name="MaxUptimeDays"           Value="-6" />
<Option Name="Scenario"                    Type="reminder" />
<Option Name="CreateScriptsAndProtocols"   Enabled="True" /> 
<Option Name="LimitToastToRunEveryMinutes" Enabled="True" Value="1" />
<Option Name="UseSoftwareCenterApp"        Enabled="False" />
<Option Name="UsePowershellApp"            Enabled="True" />
<Option Name="CustomAudio"   Enabled="False" />
<Option Name="LogoImageName" Value="ToastLogoImageDefault.jpg" />
<Option Name="HeroImageName" Value="ToastHeroImageDefault.jpg" />
...

So, when launching toast.ps1 with PendingRebootUptime.xml config, it would first read “vanilla config” and then would "replace" necessary values from PendingRebootUptime.xml.
In this case a specific action config would contain only params that are essential for that action.

Notification is displayed even when application is already installed

When using the RunApplicationID option the notification will also display, even if the application is already installed.

To fix this I edited the New-ToastNotification.ps1 and added another if clause in the function Write-ApplicationIDRegistry at around row 632.

Old:

if ($TestApplicationID) {
	Write-Log -Message "ApplicationID: $RunApplicationIDValue was found in WMI as deployed to the client"
	Write-Log -Message "Writing the ApplicationID to registry"
	if ((Get-ItemProperty -Path $RegistryPath -Name $RegistryName -ErrorAction SilentlyContinue).$RegistryName -ne $RunApplicationIDValue) {
		try {
			New-ItemProperty -Path $RegistryPath -Name $RegistryName -Value $RunApplicationIDValue -PropertyType "String" -Force   
		}
		catch {
			Write-Log -Level Error -Message "Failed to write ApplicationID: $RunApplicationIDValue to registry"
		}
	}
}
else {
	Write-Log -Level Error -Message "ApplicationID: $RunApplicationIDValue was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr"
	Write-Log -Level Error -Message "Script will exit here. Not displaying toast notification when specified application is not deployed"
	Exit 1
}

New:

if ($TestApplicationID) {
	Write-Log -Message "ApplicationID: $RunApplicationIDValue was found in WMI as deployed to the client"
	if ($($TestApplicationID.InstallState) -eq "NotInstalled") {
		Write-Log -Message "Writing the ApplicationID to registry"
		if ((Get-ItemProperty -Path $RegistryPath -Name $RegistryName -ErrorAction SilentlyContinue).$RegistryName -ne $RunApplicationIDValue) {
			try {
				New-ItemProperty -Path $RegistryPath -Name $RegistryName -Value $RunApplicationIDValue -PropertyType "String" -Force   
			}
			catch {
				Write-Log -Level Error -Message "Failed to write ApplicationID: $RunApplicationIDValue to registry"
			}
		}
	} else {
		Write-Log -Level Error -Message "Application is already installed"
		Write-Log -Level Error -Message "Script will exit here. Not displaying toast notification because specified application is already installed"
		Exit 1
	}
}
else {
	Write-Log -Level Error -Message "ApplicationID: $RunApplicationIDValue was not found in WMI as deployed to the client. Please check the config.xml or deployment in ConfigMgr"
	Write-Log -Level Error -Message "Script will exit here. Not displaying toast notification when specified application is not deployed"
	Exit 1
}

I honestly don't know how github works, therefore I am not sure how to add this to the code.

Select-Object : Property "#text" cannot be found.

For example
Changing:
$AttributionText = $XmlLang.Text | Where-Object {$_.Name -like 'AttributionText'} | Select-Object -ExpandProperty '#text'

to
$AttributionText = $XmlLang.Text | Where-Object {$_.Name -like 'AttributionText'} | Where-Object { $_.PSobject.Properties.name -match '#text' } | Select-Object -ExpandProperty '#text'

Feature? - Open Software Center in foreground

Not sure if this actually feasible or even doable but we have the following problem:

I've defined the following setting in the XML:

<Option Name="Action1" Value="softwarecenter:SoftwareID=ScopeId_968C5854-F7DB-48D1-B4AA-C4DCEAE28031/Application_2360a124-41a9-4d27-a400-41e0a628ad32" />

But upon clicking ActionButton1 the Software Center opens behind other windows. In the Alt-Tab menu it is listed in last place. This is kinda suboptimal because it hides the windows from the user's eyes.
Even worse is when you have a fullscreen RDP connection open. In that case the toast notification pops up nicely in front of the fullscreen RDP window but upon clicking the ActionButton1 the Software Center windows is moved to the background and the user gets confused about where the window went.

Would it somehow be possible to make the Software Center open in the foreground/be the window on top?

The Microsoft documentation https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=builder-syntax#buttons seems to suggest that you can do something like that.

CustomAudio

CustomAudio = $True section is broken.

Invoke-Command -ScriptBlock {
Add-Type -AssemblyName System.Speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
sleep 1.25
$speak.SelectVoiceByHints("female",65)
$speak.Speak($CustomAudioTextToSpeech)
$speak.Dispose()
}

Needs to be moved to the try section of function Display-ToastNotification()
Line 693

Added sleep to prevent audio from overlapping notification chime.

Selection between SoftwareCenter app and PowershellApp

Why not having a single string based setting to select which thing to use instead of too redundant booleans?

Also a fallback option on the setting in my opinion would be great instead of choosing only one of those and failing on systems without ConfigMgr client when the preferred thing is SoftwareCenter.

I would do a pull request myself if needed, but I don't know if the purpose of using booleans instead is due to some issue or just a design decision.

Applocker and running the script in user context

I wanted to run the script in user context but i am getting issues with it running side by side with applocker. Having the username inside ToastRunApplicationID.cmd makes the file unique on each computer and that way there is no way for us to securely whitelist the file. As we would need a seperate file hash for every single user in the company. Would it be possible to at least make sure these files are the same on every machine? Either by providing the username as a parameter or making the cmd file lookup the username itself?
image

Also yes we will try running the 2.2 version in system context for now, I just wanted to report this issue, in case its fixable.

Learn More Button - Dismisses Toast

When using a Learn More button to launch a webpage the toast message gets dismissed as well. Can that be prevented? Also is there a way to have that website launch brought into focus. It often seems to quietly load up in a new tab.

The different ActivationTypes are tricky to me. I'd love to know how to just run a .bat or .ps1 from them as well. We are not a configMgr shop.

Notifications deployed through InTune Win32 packaged installers in a SYSTEM context don't have sufficient folder rights for the unelevated user to run the notification script

I've been working to integrate toast notifications into some of my Win32 InTune Installer packages, all of which deploy in the SYSTEM context, and noticed that the notifications wouldn't show when deployed via InTune despite working in PSEXEC. I could briefly see a PowerShell window flash, but that was it. After investigating, I found that when InTune stages a system-context package for installation, only the SYSTEM account and Administrators group have access to the install folder, period.

I added this to the beginning of my install script to overcome this, which essentially just grants Read & Execute rights to the Users group for the installation folder. Not sure if this is something that could be integrated and locked behind an XML parameter. Obviously, depending on the package, this might not be smart to enable by default, but for me personally the packages I'm working on incorporating Toast notifications into don't contain any sensitive information.

# Initialize Variables
$ScriptPath = (Get-Item .).FullName

# Grant user read access to install folder so that the notification script can be run by the user later
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule ("users", "ReadAndExecute", "ContainerInherit,ObjectInherit", "None", "Allow")
$ACL = Get-Acl $ScriptPath
$ACL.SetAccessRule($AccessRule)
Set-Acl $ScriptPath $ACL

I'm not sure if this super cool script is still being actively developed, but hopefully this information helps someone. Thanks for making this!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.