Monday, January 9, 2012

Opening MsgBoxes using PowerShell


PowerTip of the Day, from


eed a quick message box to display something or ask a question? Fortunately, PowerShell can access old COM components. Here's a line that creates a MsgBox for 5 seconds. If the user does not make a choice within that time, it returns -1: a perfect solution for scripts that need to run unattended if no one is around.

$msg = New-Object -ComObject WScript.Shell

$msg.Popup("Hello", 5, "Title", 48)

To find out more about the Popup() method and its arguments, visit:

This link documents all the other WSH scripting methods as well



No comments:

Post a Comment