Home » How To » How to Automatically Display a Message When Shutting Down Windows

How to Automatically Display a Message When Shutting Down Windows

When you shut down Windows, it automatically tries to close all open apps and turns off the computer silently. However, under certain circumstances, you might want to display a custom message during shutdown. That way, you’ll have a chance to ensure important tasks aren’t forgotten. For example, to remind users to unplug external drives, save critical files, or simply display a custom goodbye message.

In this quick and easy guide, I will show you how to automatically display a message when shutting down Windows using a PowerShell script and a desktop shortcut. Let’s get started.

Good to read: How to shut down Windows on schedule

Display Message When Shutting Down Windows

For Windows to display a message when shutting down, the first thing we need to do is create a PowerShell script. To do that, open the Start menu by pressing the “Windows key” on your keyboard. Next, search for “Notepad” and click “Open” to open the Notepad app.

Open Notepad in Windows 10

Once the Notepad opens, copy (Ctrl + C) and paste (Ctrl + V) the following script into it. Next, customize the message by modifying the “Your custom message here” page of the script.

# WindowsLoop Shutdown Message
Add-Type -AssemblyName PresentationFramework
[System.Windows.MessageBox]::Show('Your custom message here', 'Shutdown Reminder')
Stop-Computer -Force

For example, to remind users to unplug the external drives, you’d modify the line as: [System.Windows.MessageBox]::Show('Unplug external drives!', 'Shutdown Reminder').

PowerShell script to display shut down message

After adding and customizing the script, press “Ctrl + S“. In the “Save as” dialog, select a destination folder of your choice, enter “shutdown-message.ps1” in the “File name” field, select “All files” from the “Save as type” dropdown menu, and click “Save“. This action saves the script file with a “.ps1” extension.

save PowerShell script

Once we have our PowerShell script, we need to create a desktop shortcut to run it so Windows can display the message before shutting down. To do that, go to your desktop (Windows key + D), right-click, and select “New” and then “Shortcut“.

create new shortcut

In the “Type the location of the item” field, enter the following command while replacing the dummy path (C:\Path\To\shutdown-message.ps1) with the actual path of the script file we just created. This command bypasses PowerShell’s execution policy restriction to run the script.

Click “Next” to continue.

powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\shutdown-message.ps1"
add script path to shortcut dialog

Enter a name for the shortcut in the “Type a name for this shortcut” field and click “Finish“. With that, you’ve created a custom shortcut to run the PowerShell script.

save shortcut

That is it. From now on, whenever you want to shut down, double-click the shutdown shortcut we just created. It will show the custom message before shutting down. Clicking the “OK” button or closing the dialog box will continue the shutdown process.

shut down message

Keep in mind that if you don’t use the newly created shortcut to shut down your computer, the custom message will not appear. To ensure you use this shortcut, I recommend removing the shutdown option from the Start menu and the Power User menu.

If you have any questions or need help, comment below. I’ll be happy to assist.

Good to read: How to display a custom message on schedule or on a specific event in Windows

Leave a Comment

Your email address will not be published. Required fields are marked *