Table of Contents
Would you like to learn how to create a pop-up message using Powershell? In this tutorial, we are going to show you how to use Powershell to create an alert message on a computer running Windows
Create a pop-up message
1. Open a new PowerShell window.
2. Create a pop-up message using PowerShell.
[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms')
[System.Windows.Forms.MessageBox]::Show('Automatic logoff after 1 hour of inactivity','WARNING')
Alternatively, you can create a pop-up message using Windows Command Prompt.
powershell -WindowStyle hidden -Command "& {[System.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms'); [System.Windows.Forms.MessageBox]::Show('Automatic logoff after 1 hour of inactivity','WARNING')}"
Create a Notification balloon
You can using the code below to create a Notification balloon using PowerShell.
[reflection.assembly]::loadwithpartialname('System.Windows.Forms')
[reflection.assembly]::loadwithpartialname('System.Drawing')
$notify = new-object system.windows.forms.notifyicon
$notify.icon = [System.Drawing.SystemIcons]::Information
$notify.visible = $true
$notify.showballoontip(10,'WARNING','Automatically logoff after 1 hour of inactivity',[system.windows.forms.tooltipicon]::None)
Or you can create it using Command Prompt:
powershell -WindowStyle hidden -Command "[reflection.assembly]::loadwithpartialname('System.Windows.Forms');[reflection.assembly]::loadwithpartialname('System.Drawing');$notify = new-object system.windows.forms.notifyicon;$notify.icon = [System.Drawing.SystemIcons]::Information;$notify.visible = $true;$notify.showballoontip(10,'WARNING','Automatically logoff after 1 hour of inactivity',[system.windows.forms.tooltipicon]::None)"
5/5 - (1 vote)