Monday, January 9, 2012

Opening MsgBoxes using PowerShell

 

PowerTip of the Day, from PowerShell.com:

 

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:

http://msdn.microsoft.com/en-us/library/x83z1d9f(v=VS.84).aspx

This link documents all the other WSH scripting methods as well

 

Thanks

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.