Here is a generic PowerShell MsgBox function that you can add to your scripts for displaying a modal message box UI. Only 2 lines of code!

Function MsgBox($Message, $Title)
{
   [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.VisualBasic")
   [Microsoft.VisualBasic.Interaction]::MsgBox($Message, "SystemModal,Information", $Title)
}

MsgBox "This is my modal message box demo." "My Modal Message Box"

Here is the result:

ModalMsgBox

 

Advertisements