Windows Toast Notification Action to initiate PowerShell Command....possible?
Hello All,
I want to create Windows Toast Notification with Action button. If I click an action button then it should trigger PowerShell command. Is this possible?
In below code, clicking dismiss button, DismissAction should invoke PS Command : {New-Item -Path 'C:\DismissFile.txt' -ItemType File -Force}
(File to create as to stop the recurrence of the notification)
I am writing PS script for that however stuck at this step.
Below is the Toast Code:
Build XML Template
[xml]$ToastTemplate88 = @"
<toast>
<visual>
<binding template="ToastGeneric">
<text>Pledge Notification</text>
<text placement="attribution">via IT Team</text>
<group>
<subgroup>
<text hint-style="body" hint-wrap="true" >Dont miss to take Pledge today! Click on Pledge button below!</text>
</subgroup>
</group>
</binding>
</visual>
<actions>
<action activationType="protocol" arguments="$PledgeURL" content="Pledge URL" />
<action activationType="foreground" arguments="$DismissAction" content="Dismiss" />
</actions>
</toast>
"@
Any similar has anyone tried. Please suggest way forward.
Thanks in advance!