Search code examples
windowspowershellvbscripticonsmessagebox

How to create a message box with new icons with VBScript or PowerShell?


I have done VBScript and PowerShell message boxes since a while, but, I want to use the Windows 10 icons like these:

New icons

The only thing I want to do is to replace the Windows 7 icons to the Windows 10, as they are more modern.

Is there any way to change these icons?


Solution

  • Here's one quick code example for PowerShell:

    Add-Type -AssemblyName System.Windows.Forms | Out-Null
    [System.Windows.Forms.Application]::EnableVisualStyles()
    $btn = [System.Windows.Forms.MessageBoxButtons]::OK
    $ico = [System.Windows.Forms.MessageBoxIcon]::Information
    $Title = 'Welcome'
    $Message = 'Hello world'
    $Return = [System.Windows.Forms.MessageBox]::Show($Message, $Title, $btn, $ico)
    

    Output:

    enter image description here

    If I find a VBScript solution, I'll follow-up.

    Hope this helps.