PowerTip: Use PowerShell to Display Pop-Up Window

Summary: Learn how to display a pop-up window by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display a pop-up window to a user when a script or function has completed?

Hey, Scripting Guy! Answer There are several ways to display a pop-up window, but the following command doesn’t require
          loading assemblies prior to creating the window:

$wshell = New-Object -ComObject Wscript.Shell

$wshell.Popup("Operation Completed",0,"Done",0x1)

Note  For more information, see Popup Method.

Comments (16)

  1. Boe Prox says:


    Well played! That is definitely another type of *box that is available to use.

  2. Boe Prox says:

    @Dan Hayward
    It can be one line if you want (as your example shows).

  3. tommymaynard says:

    If anyone uses jv’s examples, be sure to add the left square bracket [ to the beginning of the last two lines.

  4. Anonymous says:

    Is there any way to link applications based on java to powershell..?

  5. jv says:

    I will see your “MsgBox” and raise you an “InputBox”:

    Add-Type -AssemblyName Microsoft.VisualBasic
    Microsoft.VisualBasic.Interaction]::MsgBox(‘Hello’,1,’My MessageBox’)
    Microsoft.VisualBasic.Interaction]::InputBox(‘Enter you name:’, ‘User Inforation’,’Joe Smith’)

  6. Dan Hayward says:

    Why two lines?

    (new-object -ComObject wscript.shell).Popup("Operation Completed",0,"Done",0x1)

    If you want to remove the "Cancel" button, remove the ",0x1" at the end…

  7. la_bruin says:

    Great post! Was wondering if anyone had any idea if you wanted to insert the local computer name in the pop up window.

    somethink like:
    $wshell.Popup("Welcome $ComputerName Your network drives are mounted",0,"Mappning")

    And also if you could make it Time-based so that the user didnt have to push OK or cancel button. So it would dissapear in 5 sec or so.

    Thanks in advance.

  8. uday kiran says:

    Hi Kurt,

    $wshell.Popup("Welcome $Env:ComputerName Your network drives are mounted",5,"Mappning")

  9. test says:

    This is a test

  10. Insert Name Here says:

    Can you send messages to other people on the same network?

  11. Amy says:

    Can a custom image be included in to a pop up? Like say a logo

  12. techuser says:

    [System.Windows.Forms.MessageBox]::Show("Title" , "Content")

  13. Shakti says:

    How do you create the popup box with only message and no buttons (or buttons grayed out along with X button)?

  14. emerson says:

    how about including a textbox?

  15. Jan IT says:

    Is there a way to use the MessageDialog class in Powershell? I want to use the "Big Popup Dialog" (Windows 8 and above) along the Screen. Or is there another way to use that in Powershell / .Net?