In places where people are hyper sensitive about rebooting their machines, sometimes they need a gently reminder. In an effort to encourage my users to reboot their systems, I have started using Balloon (Toast) Notifications to prompt them every couple of hours in attempt to encourage them. This has been pretty successful for me. Hopefully it will help others as well.

I use this script in conjunction with a smart label that contains computer that have not been rebooted for more than 14 days but under 21 days. 
 -You can change this to whatever fits. I chose this because after bugging them for a week, I change the script to a reboot countdown.

SELECT 
    MACHINE.NAME AS SYSTEM_NAME,
    SYSTEM_DESCRIPTION,
    MACHINE.IP,
    MACHINE.MAC,
    MACHINE.ID AS TOPIC_ID
FROM
    MACHINE
WHERE
    ((OS_NAME NOT LIKE '%server%')
        AND (LAST_REBOOT < DATE_SUB(NOW(), INTERVAL 14 DAY)
        AND LAST_REBOOT > DATE_SUB(NOW(), INTERVAL 21 DAY)))
Then, We set up the script to notify the users...

Run As: Local System
CHECK: Allow run without logged in user

Launch a program...
Dir: $(KACE_SYS_DIR)
File: powershell.exe
Params: -sta -executionpolicy bypass -file "$(KACE_DEPENDENCY_DIR)\Reboot_Toast.ps1"
Do Not check: Wait for completion.

Here is the script:

[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | out-null
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") | out-null
$TimeStart = Get-Date
$TimeEnd = $timeStart.addminutes(360)
Do
{
	$TimeNow = Get-Date
	if ($TimeNow -ge $TimeEnd)
	{
		
		Unregister-Event -SourceIdentifier click_event -ErrorAction SilentlyContinue
		Remove-Event click_event -ErrorAction SilentlyContinue
		[void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
		[void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
		Exit
	}
	else
	{
		$Balloon = new-object System.Windows.Forms.NotifyIcon
		$Balloon.Icon = [System.Drawing.SystemIcons]::Information
		$Balloon.BalloonTipText = "A reboot is required in order to complete Security patching. Please reboot at your earliest convenience."
		$Balloon.BalloonTipTitle = "Reboot Required"
		$Balloon.BalloonTipIcon = "Warning"
		$Balloon.Visible = $true;
		$Balloon.ShowBalloonTip(20000);
		$Balloon_MouseOver = [System.Windows.Forms.MouseEventHandler]{ $Balloon.ShowBalloonTip(20000) }
		$Balloon.add_MouseClick($Balloon_MouseOver)
		Unregister-Event -SourceIdentifier click_event -ErrorAction SilentlyContinue
		Register-ObjectEvent $Balloon BalloonTipClicked -sourceIdentifier click_event -Action {
			Add-Type -AssemblyName Microsoft.VisualBasic
			
			If ([Microsoft.VisualBasic.Interaction]::MsgBox('Would you like to reboot your machine now?', 'YesNo,MsgBoxSetForeground,Question', 'System Maintenance') -eq "NO")
			{ }
			else
			{
				shutdown -r -f
			}
			
		} | Out-Null
		
		Wait-Event -timeout 7200 -sourceIdentifier click_event > $null
		Unregister-Event -SourceIdentifier click_event -ErrorAction SilentlyContinue
		$Balloon.Dispose()
	}

}
Until ($TimeNow -ge $TimeEnd)

You can edit the re-prompt time frame and length to your liking. Currently it prompts every 2 hours for 6 hours. The highlighted 360 is for the over all length and 7200 is the time (in seconds) between prompts.


Here are some screens:

Icon in Tray:

jdoCTX.png

The Toast Notification:

KkE4fB.png

Prompt on Balloon or Icon Click:

n7e8JQ.png


Let me know if you have any questions or feedback,


Thanks!