How to get Pop up message box using Powershell

by Sitaram Pamarthi on October 19, 2010

AFAIK, there are two ways available to generate a Pop-up message box using powershell.

Simple way:-

In this powershell relies on a method which is available in windows shell object(WSH). In this you can control four factors, “Message box title”, “Message”, “timeout for message box”, “box type”.

Below is a simple example.

$a = new-object -comobject wscript.shell
$b = $a.popup(“This is a test message from http://Techibee.com “,0,”Test message from techibee”,1)

Second and effective method:-

In this we can make use of dotnet windows forms to generate the pop-up message boxes. Though code looks bit heavy it works very well and has lot of flexibility.

[System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)
[Windows.Forms.MessageBox]::Show(“Test message from Techibee.com!. Subscribe to news letters, RSS feeds at http://techibee.com to stay tuned”, “PowerShellScripts.blogspot.com”, [Windows.Forms.MessageBoxButtons]::OK, [Windows.Forms.MessageBoxIcon]::Information)

This post was written by...

– who has written 504 posts on Techibee.com.

Sitaram Pamarthi is a windows administrators with 9+ years of experience.read more

Previous post:

Next post: