cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Toast Message - Reboot Computer When Patched

Andy_Sismey
Champion Sweeper III

Its always handy to ask the User to reboot once the install has finished, here is a simple TOAST message with Image (445 x 266) to add to the end of the deployment...

Edit the following Powershell with the message, image location etc


copy-Item "***Path To Images***\images\reboot.png" -Destination "C:\temp"
Start-Sleep -Seconds 3
$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]


$Template = [Windows.UI.Notifications.ToastTemplateType]::ToastImageAndText01

#Gets the Template XML so we can manipulate the values
[xml]$ToastTemplate = ([Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($Template).GetXml())

[xml]$ToastTemplate = @"
<toast launch="app-defined-string">
<visual>
<binding template="ToastGeneric">
<text>Computer Reboot Required</text>

<image placement="inline" src="c:\temp\reboot.png" />

<text>Please reboot your computer to complete the installation of NEW Features and Important Updates.</text>

</binding>
</visual>
<actions>
<action activationType="background" content="Close" arguments="later"/>
</actions>
</toast>
"@

$ToastXml = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument
$ToastXml.LoadXml($ToastTemplate.OuterXml)

$notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app)

$notify.Show($ToastXml)


Th Command Required :

powershell.exe -executionpolicy bypass -file "\\Server\defaultpackageshare$\software\messages\Reboot.ps1"

0 REPLIES 0