Show a Popup Dialog From PowerShell
Display a native Windows message box with a title and buttons.
Run the snippet to open a message box; click OK to dismiss it.
01Command
Command
$ Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show("Hello from PowerShell","cmdcv")02What it does
Loading System.Windows.Forms exposes the Win32 MessageBox API to PowerShell. The second argument is the title, and a third argument can choose buttons and an icon; the returned value tells you which button was clicked, so scripts can ask the user a question.
03Risk
!Warning: Message boxes block until dismissed, so never call them in unattended or scheduled scripts.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- MessageBox ClassEvidence: Displays a message window to the user; Show returns the clicked button.
Last verified: 2026-09-20 · Category: System & Settings
06Related solutions
Grep on Windows: Select-String
Search inside text files and logs with regex, returning file, line number and match.
Zip Files with Compress-Archive
Create or update a .zip from any files or folder contents straight from PowerShell.
Test a TCP port connection on Windows with Test-NetConnection
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.