Notification

Icon
Error

Toast Message - Reboot Computer When Patched - Toast Message

Posted: Wednesday, August 11, 2021 12:18:30 PM(UTC)
Andy.S

Andy.S

Member Original PosterPosts: 123
0
Like

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

Code:

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 :

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

Active Discussions

Lansweeper Marking/Flagging VIP Customers
by  C Johnson   Go to last post Go to first unread
Last post: Yesterday at 11:43:22 PM(UTC)
Lansweeper Office 2016 key scanning
by  WaldoIT  
Go to last post Go to first unread
Last post: Yesterday at 3:40:41 PM(UTC)
Lansweeper Configuring SSL in IIS Express issue
by  saffo   Go to last post Go to first unread
Last post: Yesterday at 9:57:31 AM(UTC)
Lansweeper MDM Jamf School
by  Eugene  
Go to last post Go to first unread
Last post: 12/3/2021 6:21:44 PM(UTC)
Lansweeper HTTPS not secure
by  Luke Maslany   Go to last post Go to first unread
Last post: 12/3/2021 2:23:28 PM(UTC)
Lansweeper Problem with deploy software
by  Max90  
Go to last post Go to first unread
Last post: 12/3/2021 2:04:12 PM(UTC)
Lansweeper scanning target by range
by  Colombini   Go to last post Go to first unread
Last post: 12/3/2021 12:06:19 PM(UTC)
Lansweeper Log WIFI networks
by  BastiOn  
Go to last post Go to first unread
Last post: 12/3/2021 10:29:38 AM(UTC)